Help - Search - Members - Calendar
Full Version: Registration Form and Database
ieXbeta Board > Tech > Developer Center
ml20
I run a local soccer club's website, and they are intrested in online player registration.

Sooo... I am looking for advice on how to get a form up and running (with database) that will achieve the following:


--- All player information would be filled out in a form and sumbitted to a local database.

--- The database needs to be sortable and able to be manipulated (like edit a player's name after they submitted the form) like an excel document.

--- Once the player has submitted the form and it has been processed, they will recieve a reciept containing what they submitted with an registration number via email.



Programming Language doesn't really matter. It doesn't need to be PHP/MySQL, but it does have to be secure. It could be a script that just adds a line of data to an online excel file.

I have already tried phpFormGenerator, and it is close but not quite what I am looking for sad.gif
The main problem with this script is that the database can not be manipulated or sorted. It doesn't include the email/reciept feature either, which I guess I don't really need.

If there are no free or cheap scripts that do all or most of the tasks above, please recommend scripts that I could 'combine' or do in separate steps to acomplish my goal. Or sites that would help me code my own script.

thank you smile.gif



edit: by the way, there will be NO online payment or anything like that. It will just be player information. but that is why I need a email/reciept and a registration number so we can check the player off after he/she has payed.
Taco Bell
There are some free team-related web site hosts that might be a better start than doing all this from scratch.

My co-worker has one for her son's hockey team, but I'm not sure the name of it and unfortunately she's on a vacation for the next week. I can ask her whe she gets back though if your still interested and you could always try Googling it in the meantime.
ml20
ok. I've got the form up and working, now i just have one minor field validation problem:

I can't get checkboxes and radio buttons to validate.

Here's the situation:

-----2 groups of radio buttons:
One group with 2 options
One group with 3 options
I need to have one radio button selected in each group, or the form will halt.

-----1 check box that is like a 'disclaimer', and it just needs to be checked period unless the form will halt.

I have searced google and found tons of javascript, but none that fits my case in partcular and works.

any suggestions?



Jleagle
i take it your dealing with php..


for the tick box just have:-

if ($_POST['disclaimer'] = true){

carry on;

}else{

echo 'tick the box!';

}
ml20
well i should have done it in php, but i didn't. it is a basic html form with a php processor. I guess i was looking for javascript for the validator
DangerousDave86
you could use the forms onsubmit event to check the checkbox, and if its checked, return true, and if not return false and do an alert() or something similar.
Dutch2005
would't

some thin in this trend work??

CODE

include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','urllink');
pt_register('POST','piclink');
if($urllink=="" || $piclink=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if($errors==1) echo $error;
else{
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="url link: ".$urllink."
pic link: ".$piclink."
";




$piclink=="" also works with a checkbox

were $checkbox=="" would be not agreed & the other 1 be checked ;-)

gblobal.inc.php
CODE

<?php

function pt_register()
{
  $num_args = func_num_args();
   $vars = array();

   if ($num_args >= 2) {
       $method = strtoupper(func_get_arg(0));

       if (($method != 'SESSION') && ($method != 'GET') && ($method != 'POST') && ($method != 'SERVER') && ($method != 'COOKIE') && ($method != 'ENV')) {
           die('The first argument of pt_register must be one of the following: GET, POST, SESSION, SERVER, COOKIE, or ENV');
     }

       $varname = "HTTP_{$method}_VARS";
      global ${$varname};

       for ($i = 1; $i < $num_args; $i++) {
           $parameter = func_get_arg($i);

           if (isset(${$varname}[$parameter])) {
               global $$parameter;
               $$parameter = ${$varname}[$parameter];
          }

       }

   } else {
       die('You must specify at least two arguments');
   }

}

?>
unkle stu
create 2 files, register.html and procress.php

register.html:
CODE

<html>
    <body>
        <form method="post" action="process.php">
            What color?<br>
            <input type=radio name="color" value="red" checked />Red<br>
            <input type=radio name="color" value="blue" />Blue<br>
            <br>
            What size?<br>
            <input type=radio name="size" value="s" checked />Small<br>
            <input type=radio name="size" value="m" />Medium<br>
            <input type=radio name="size" value="l" />Large<br>
            <br>
            blah blah<br>
            <input type=checkbox name="agree" /> I Agree<br>
            <br>
            <input type=submit value="Submit" />
        </form>
    </body>
</html>


process.php:
CODE

<?php

    if (isset($_POST['agree']))
    {
        // the i agree checkbox was checked, let's move on

        echo ($_POST['color']);

        echo ('<br>');

        if ($_POST['size'] == 's')
            echo ('small');
        else if ($_POST['size'] == 'm')
            echo ('medium');
        else if ($_POST['size'] == 'l')
            echo ('large');

    }
    else
    {
        echo('<script language="javascript">alert("You must agree.");</script>');
        echo('<script language="javascript">history.back();</script>');
    }

?>


That should get the ball rolling.. you can add Javascript to the html page which will for instance make sure the checkbox is checked, and avoid ever loading process.php

Remember that server-side (php) input validation is mandatory, client-side (javascript) optional.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.