Jump to content

[SOLVED] Not getting information from table using POST method


greed460

Recommended Posts

It seems that the POST is getting information from the form, optionalinfo. But seem to lack the ability to get information using the POST method from the form, requiredinfo. It's probably something simple, but I've read and reread this.

 

PHP:

 

function randverify() 
{
$rand1 = rand(1,9);
$rand2 = rand(1,9);
$total = $rand1 + $rand2;

echo "$rand1 + $rand2 = ?";
}
$submit = $_POST["submit"];
//necessary info
$username = $_POST["username"];
$password = $_POST["password"];
$confpass = $_POST["confpass"];
$email = $_POST["email"];
$verification = $_POST["verify"];
$date = date("Y-m-d");
//optional info
$firstname = $_POST["firstname"];
$lastname = $_POST["lastname"];
$age = $_POST["age"];
$aim = $_POST["aimname"];
$xfire = $_POST["xfirename"];
$iq = $_POST["iq"];

//check if submit button has been pressed
if ($submit) {
if ($username && $password && $confpass && $email) {
	$password = md5($password);
	$confpass = md5($confpass);

if ($password==$confpass) {
	if (strlen($password) < 5 || strlen($confpass) < 5) {
		echo "<p align='center'<b>Password must be at least <u>6</u> characters long!</b></p>";
		}
	else {
		//register the user!
		}
	}
else {
	echo "<p align='center'<b>Passwords do <u>not</u> match!</b></p>";
	}
}
else {
	echo "<p align='center'<b>Please fill in <u>all required fields</u>!</b></p>";
}
}

 

HTML (form for the related problems):

 

<form action="register.php" name="requiredinfo" method=POST>
<table align="center" cellspacing="2" cellpadding="2" border="2" bordercolor="#D7D7D7	" bordercolordark="black" bgcolor="#979797">
<th>Required Information</th>
<tr><td>
*Username: <input type="text" name="username" maxlength="15">
</td></tr>
<tr><td>
*Password: <input type="password" name="password" maxlength="20">
</td></tr>
<tr><td>
*Confirm Password: <input type="password" name="confpass" maxlength="20">
</td></tr>
<tr><td>
*Email: <input type="text" name="email" maxlength="25">
</td></tr>
</table>

<table align="center" cellspacing="2" cellpadding="2" border="2" bordercolor="#D7D7D7	" bordercolordark="black" bgcolor="#979797">
<th>*Human Verification</th>
<tr><td>
	<input type="text" name="verify" maxlength="2">
</td>
<td>
	<?php
		randverify();
	?>
</td>


</tr>
</table>
</form>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.