Jump to content

Post and Get Problem


shinyjoy

Recommended Posts

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

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

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.