Solved]Radio button help
Posted: Thu Jun 16, 2005 7:32 am
i have followed the code in authetication 101 php tutorial, and it is working fine, but i have to add a radio button, these radio buttons will indicate a different of page to be redirected, below is my code, i dont know how to pass the variable of the radio button.... thanks for the help!
any tutorial site would help...
any tutorial site would help...
Code: Select all
<?PHP
$db = mysql_connect('xx', 'xx', 'xx') or die("Couldn't connect to the database.");
mysql_select_db('mydatabase') or die("Couldn't select the database");
$result = mysql_query("SELECT count(userId) FROM users WHERE userPass='$_POST[userPass]' AND userName='$_POST[userName]'") or die("Couldn't query the user-database.");
$num = mysql_result($result, 0);
if (!$num) {
echo"
<style type='text/css'>
<!--
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
<table width='367' height='218' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td background='login.gif'><table width='367' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td><div align='center'>
<form action='$_SERVER[PHP_SELF]' method='post'>
<input type='text' name='userName' value='$_POST[userName]'>
</div></td>
</tr>
<tr>
<td><div align='center' class='style1'>Username</div></td>
</tr>
<tr>
<td><div align='center'>
<input type='password' name='userPass'>
</div></td>
</tr>
<tr>
<td><div align='center' class='style1'>Password</div></td>
</tr>
</table>
<table width='367' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width='71' rowspan='4'> </td>
<td width='126'> </td>
<td width='97' rowspan='4'><div align='center'>
<input type='submit' name='Submit' value='Login'>
</div></td>
<td width='73' rowspan='4'> </td>
</tr>
<tr>
<td class='style1'><input name='radiobutton' type='radio' value='tin'>
Time In </td>
</tr>
<tr>
<td class='style1'><input name='radiobutton' type='radio' value='tout'>
Time Out </td>
</tr>
<tr>
<td class='style1'><input name='radiobutton' type='radio' value='ot'>
Overtime</td>
</tr>
</table></td>
</form>
</tr>
</table>
";
} else {
session_start();
$id = session_id();
$_SESSION['userName'] = $_POST['userName'];
$_SESSION['pass'] = $_POST['pass'];
exit;
}
?>