EdoDodo Posted July 1, 2007 Share Posted July 1, 2007 Hi. I know how to make forms and how to take them and echo them and stuff but when I try to set the to variables it doesn't seem to work. Can anyone help me please? Quote Link to comment Share on other sites More sharing options...
bluebyyou Posted July 1, 2007 Share Posted July 1, 2007 Post your code please. Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted July 1, 2007 Share Posted July 1, 2007 Yes post ur code that we may help u. Quote Link to comment Share on other sites More sharing options...
EdoDodo Posted July 1, 2007 Author Share Posted July 1, 2007 Page 1: <form method="post" action="http://localhost/page2.php"> Minimum Number: <input type="text" size="10" maxlength="40" name="min_num"><br> Maximum Number: <input type="text" size="10" maxlength="10" name="max_num"><br> Number of Guesses: <input type="text" size="10" maxlength="10" name="guesses"><br> <input type="submit" value="Go!"> </form> Page 2: <?php $min_num='$_POST['min_num']'; $max_num='$_POST['max_num']'; $guesses='$_POST['guesses']'; echo '$min_num, $max_num, $guesses'; ?> I'm pretty sure it's just a silly mistaker but I'm new to PHP and stuff so I can't spot it. Quote Link to comment Share on other sites More sharing options...
bluebyyou Posted July 1, 2007 Share Posted July 1, 2007 You dont need the single quotes. With the single quotes you are puting the $_POST variables in as strings. $min_num=$_POST['min_num']; $max_num=$_POST['max_num']; $guesses=$_POST['guesses']; Quote Link to comment Share on other sites More sharing options...
EdoDodo Posted July 1, 2007 Author Share Posted July 1, 2007 I tried that and it doesn't give me the T-String error thing but it doesn't echo the variables just returns like: $min_num, $max_num, $guesses Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted July 1, 2007 Share Posted July 1, 2007 bcoz u r escaping it. try this: echo $min_num.$max_num.$guesses; Quote Link to comment Share on other sites More sharing options...
trq Posted July 1, 2007 Share Posted July 1, 2007 <?php <?php $min_num=$_POST['min_num']; $max_num=$_POST['max_num']; $guesses=$_POST['guesses']; echo $min_num, $max_num, $guesses; ?> Quote Link to comment Share on other sites More sharing options...
bluebyyou Posted July 1, 2007 Share Posted July 1, 2007 try this: echo $min_num, $max_num, $guesses; The single quote for a strings means echo litteraly what is inside, even if it is a variable name. read up on it here: http://www.php.net/types.string Quote Link to comment Share on other sites More sharing options...
rameshfaj Posted July 1, 2007 Share Posted July 1, 2007 Yes probably ! there was a blunder to use such single quotations outiside the post function. Quote Link to comment Share on other sites More sharing options...
bluebyyou Posted July 1, 2007 Share Posted July 1, 2007 you dont have to rub it in Quote Link to comment Share on other sites More sharing options...
EdoDodo Posted July 1, 2007 Author Share Posted July 1, 2007 Solved! Thanks guys! 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.