
-----------------------------------
Lanks
Sun Nov 16, 2008 4:27 pm

Verifying radio button
-----------------------------------
i have created a signin form with name, age, email etc and i'm verifying that these credentials exist using this code

// Check for a first name:
   if (preg_match ('/^[A-Z \'.-]{2,20}$/i', $trimmed['first_name'])) {
      $fn = mysqli_real_escape_string ($dbc, $trimmed['first_name']);
   } else {
      echo 'Please enter your first name!';
   }
....

....

if ($fn && $ln && $e && $p && $ag && $em && $sx) { // If everything's OK...

(add to table).....

but now i need to make sure they check one of these radio buttons

Account Type:
       Client
        User

i then need to tell the php script that is creating the entry which table to put the data in depending on which value is selected for account type... is it possible?[/code]

-----------------------------------
octopi
Sun Nov 16, 2008 5:53 pm

Re: Verifying radio button
-----------------------------------

$accountType = $_REQUEST['account_type'];
if($accountType == 'c') {
  //add to the client table
}
else if($accountType == 'u') {
  //add to user table
}
else {
  //add to default table, or throw an error
}


-----------------------------------
Lanks
Sun Nov 16, 2008 6:05 pm

RE:Verifying radio button
-----------------------------------
it works, yay

thank you octopi
