Jump to content

$_Post Variable Doesn't Seem To So What I Want


achilles1971

Recommended Posts

Here is my form:

 

<FORM action="eatnlocal_validate.php" method="post">

<P>

Name: <INPUT type="text" id="name"><BR>

Restaurant name: <INPUT type="text" id="restaurant"><BR>

Email: <INPUT type="text" id="email"><BR>

<input type="submit" value="Submit" name="submit">

</P>

</FORM>

 

Here is my eatnlocal_validate.php:

 

<?php

if (isset($_POST['name']) && isset($_POST['restaurant']) && isset($_POST['email'])){

 

$name = $_POST['name'];

$restaurant = $_POST['restaurant'];

$email = $_POST['email'];

 

header("Location: info_ad.php");

}

else{

echo "Please enter all information. Click "?><a href = "info_form.php">Here</a><?php echo" to go back.";

}

?>

 

When I enter info into all three fields, I still get the else function.

 

What am I doing wrong?

 

Thanks

You need to specify a name attribute for the input tags...

 

 

<form action="eatnlocal_validate.php" method="post">
<P>
Name: <input type="text" id="name" name="name"><br>
Restaurant name: <input type="text" id="restaurant" name="restaurant"><br>
Email: <input type="text" id="email" name="email"><br>
<input type="submit" value="Submit" name="submit">
</P>
</form>

 

and you don't really need to use id, unless it has something to do with your CSS or something...

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.