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

Link to comment
Share on other sites

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...

Edited by MMDE
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.