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

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.