|
PHP script
Hi how are you? I try to run this script but it isn't working. After entering dates, it should only come up "Thank you for fill out" Not (texts ex name country and so on)
And I would like to make a link to Home.
My php editor says "Undefined variable: rets in c:\itohideo\kkk.php on line 27"
Here is my code
<html>
<body>
<?php
$con = mysql_connect("localhost","itohideo","1234");
if(!$con) {
print("Fail DB Connection<br>\n");
exit;
}
if(!mysql_select_db("itohideo")) {
print("Fail DB Selection<br>\n");
exit;
}
if (isset($_POST["submit"])){
$number = $_POST["number"];
$name = $_POST["name"];
$country = $_POST["country"];
$query_insert = "insert into takao (number, name, country) values ('$number', '$name', '$country')";
$query_result_insert = mysql_query($query_insert, $con) or die (mysql_error($con));
if(mysql_insert_id()){
$rets = "Thank you for filling out my form";
}
mysql_close($con);
}
?>
<?
if($rets){
echo $rets;
?>
<?}else{?>
<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<P>please fill out this form and it goes to my database</P>
Number<input name="number" type="text"><br>
Name<input name="name" type="text"><br>
You country<input name="country" type="text"><br>
<input type="submit" name="submit">
<input type="reset" name="reset">
</form>
<?}?>
</body>
</html>
|