shinyjoy Posted July 3, 2010 Share Posted July 3, 2010 Hi I have set up php mysql and apache server by installing XAMPP on my pc which is windows xp sp2. And trying to get the following code run but i am not getting the variables through the post or get why, please help me. Thanks in advance. my code: <body> <H2>Search Results</H2> <BR> <FORM ACTION="result.php" METHOD="POST"> Enter name, or part of the name, of the shops you wanted: <BR> <INPUT NAME = "name" TYPE = TEXT> <BR> <INPUT TYPE= SUBMIT VALUE="Search"> </FORM> </body> php page code: result.php <? echo $_POST['name']; ?> I tried every thing like $_REQUEST['name'] and http_Post_var but nothing is working when i click on a submit, it displaying a blank page why? where is the problem; Link to comment https://forums.phpfreaks.com/topic/206620-post-and-get-problem/ Share on other sites More sharing options...
bobby317 Posted July 3, 2010 Share Posted July 3, 2010 I think you are not checking if the form is submitted: add a hidden field to your form <input type="hidden" name="submit" value="true" /> then see if form has been submitted if it has been do something: <?php if (isset($_POST['submit'])) { //set to variable for easer use $name = "$_POST['name']"; //echo variable echo "$name"; } Hope this helps: http://www.php.net/manual/en/index.php Link to comment https://forums.phpfreaks.com/topic/206620-post-and-get-problem/#findComment-1080668 Share on other sites More sharing options...
PFMaBiSmAd Posted July 3, 2010 Share Posted July 3, 2010 Use only full opening php tags in your code - <?php You got caught using php's lazy-way short open tag <? Link to comment https://forums.phpfreaks.com/topic/206620-post-and-get-problem/#findComment-1080700 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.