Forum Moderators: coopster

Message Too Old, No Replies

Why do none of my HTML forms work?

PHP is fine, but whenever html forms come into it - it never works!

         

phidentity

12:19 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



<html><head><title>Add record to nightlife_review/places </title>
</head><body>

<form action="<?php echo($PHP_SELF);?>" method="post">
ID: <input type = "text" name = "id" size = "3">
Place Name : <input type = "text" name = "name"" size = "10">
Info : <input type = "text" name = "info" size = "40">
<br>
<input type = "submit" value ="Submit">
</form>

<?php

if ( $id and $name and $info)
{
$conn=@mysql_connect("localhost","user","pass")
or die ("Err:Conn");

$rs = @mysql_select_db("nightlife_review", $conn)
or die ("Err:DB");

$sql="insert into places (id, name, info) values ( '$id', '$name', '$info')";

$rs=mysql_query($sql,$conn);

if($rs) {echo("Record Added:$id $name $info"); }

}
?>

</body></html>

User/Pass have been changed.

Why does this not work? It just does nothing.

I have been told it may be to do with global variables?

I get this notice (if I have error_all on)

Notice: Undefined variable: id in c:\apache\htdocs\west-midlands\add_record.php on line 14

Jon

phidentity

12:25 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



Ah, it was global_variables in php.ini.

Thanks anyway :)

Jon