Can someone tell me why this dosent work.
after submitting it just restes without entering any data
However this one works, the only thing ive changed is added more feilds in the form and trying to do it to a different database.
Thanks heaps
50np$'s to whoever helps
after submitting it just restes without entering any data
Code:
<html>
<body>
<?php
if ($submit) {
// process form
$db = mysql_connect("localhost", "bertie_username", "password");
mysql_select_db("bertie_assesment",$db);
$sql = "INSERT INTO profiles (username,password,email,firstname,lastname,city,state,countrey,zip,birthday,gender,squestion,sawnser) VALUES ('$username','$password','$email','$firstname','$lastname','$city','$state','$countrey','$zip','$birthday','$gender','$squestion','$sawnser')";
$result = mysql_query($sql);
echo "<?php echo $PHP_SELF?>";
}
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<table border=0>
<TR>
<TD>Username:</TD><TD><input type="Text" name="username"></TD>
</TR>
<TR>
<TD>Password:</TD><TD><input type="Text" name="password"></TD>
</TR>
<TR>
<TD>Valid Email Address:</TD><TD><input type="Text" name="email"></TD>
</TR>
<TR>
<TD>Given Names:</TD><TD><input type="Text" name="firstname"></TD>
</TR>
<TR>
<TD>Family Name:</TD><TD><input type="Text" name="lastname"></TD>
</TR>
<TR>
<TD>City:</TD><TD><input type="Text" name="city"></TD>
</TR>
<TR>
<TD>State:</TD><TD><input type="Text" name="state"></TD>
</TR>
<TR>
<TD>Country:</TD><TD><input type="Text" name="countrey"></TD>
</TR>
<TR>
<TD>Zip Code:</TD><TD><input type="Text" name="zip"></TD>
</TR>
<TR>
<TD>Birth Date</TD><TD><input type="Text" name="birthday"></TD>
</TR>
<TR>
<TD>Gender:</TD><TD><input type="Text" name="gender"></TD>
</TR>
<TR>
<TD>Secret Question:</TD><TD><input type="Text" name="squestion"></TD>
</TR>
<TR>
<TD>Secret Answer:</TD><TD><input type="Text" name="sawnser"></TD>
</TR>
<TR>
<TD colspan="2"><center><input type="Submit" name="submit" value="Enter information"></center></TD>
</TR>
</form>
<?php
// end if
?>
</body>
</html>
However this one works, the only thing ive changed is added more feilds in the form and trying to do it to a different database.
Code:
<html>
<body>
<?php
if ($submit) {
// process form
$db = mysql_connect("localhost", "bertie_username", "password");
mysql_select_db("bertie_mobster",$db);
$sql = "INSERT INTO employees (msg) VALUES ('$msg')";
$result = mysql_query($sql);
echo "<?php echo $PHP_SELF?>";
}
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<table border=0>
<TR>
<TD>Email:</TD><TD><input type="Text" name="msg"></TD>
</TR>
<TR>
<TD colspan="2"><center><input type="Submit" name="submit" value="Enter information"></center></TD>
</TR>
</form>
<?php
// end if
?>
</body>
</html>
Thanks heaps
50np$'s to whoever helps
















