cornelombaard Posted October 24, 2013 Share Posted October 24, 2013 Hi I am new to this When you have a form with various fields in them and you have given names to each field. If you submit that form then the values go sit in the array $_REQUEST am I correct? Then why do I get a index undefined? Here is the code for the form: <code> <h2> Sign my guestbook</h2><form method="post" action="entry.php"> <b>Name:</b> <input type="text" size="40" name="name"> <br><br> <b>Location:</b> <input type="text" size="40" name="location"> <br><br> <b>Email:</b> <input type="text" size="40" name="email"> <br><br> <b>Homepage:</b> <input type="text" size="40" name="url"> <br><br> <b>Comments:</b> <textarea name=”comments” cols=”40” rows=”4” wrap=”virtualv></textarea> <br><br><input type="submit" name="submit" value="Sign!"> <input type="reset" name="reset" value="Start over"> </form></form> </code> Here is the code for entry.php <code> <?phpinclude 'includes/dbconnect.php';if($_REQUEST['submit'] == "Sign!"){ $query = "insert into guestbook (name, location, email, url, comments) values ('".$_REQUEST['name']."', '".$_REQUEST['location']."', '".$_REQUEST['email']."', '".$_REQUEST['url']."', '".$_REQUEST['comments']."')"; mysql_query($query);?><h2>Thanks</h2><h3><a href="view.php">View my guesbook</a></h2><?php}else{ include 'sign.php';}?> </code> I need to understand what happend when a form is submitted where fields have names and the method used it post. Any help is greatly appreciated Thanks Quote Link to comment Share on other sites More sharing options...
Solution cornelombaard Posted October 24, 2013 Author Solution Share Posted October 24, 2013 I changed so I could see the contents of the variable $_REQUEST and I see there is an index for comments but there are some funny symbols too. I am using Mandriva Linux [â€commentsâ€] Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted October 24, 2013 Share Posted October 24, 2013 Because you're using smart quotes (i think that is what they are called) name=”comments” Instead of normal quotes name="comments" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.