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;
Post and Get are not working, please help
Moderator: General Moderators
Re: Post and Get are not working, please help
The page isn't blank - it just looks that way to you.
Code: Select all
<?php
echo $_POST['name'];
?>Re: Post and Get are not working, please help
actually it's not passing any variable
even if wrote code like this, i couldn't get any thing. see below..
even if wrote code like this, i couldn't get any thing. see below..
Code: Select all
<?php
$var = $_POST['name'];
echo $var;
?> Re: Post and Get are not working, please help
Code: Select all
<body>
<H2>Search Results</H2>
<BR>
<FORM ACTION=<?php echo $_SERVER[PHP_SELF]; ?> 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
echo $_POST["name"];
?>
-
internet-solution
- Forum Contributor
- Posts: 220
- Joined: Thu May 27, 2010 6:27 am
- Location: UK
Re: Post and Get are not working, please help
shinyjoy wrote:actually it's not passing any variable
even if wrote code like this, i couldn't get any thing. see below..Code: Select all
<?php $var = $_POST['name']; echo $var; ?>
Try dumping the $_POST array, and see its content
Code: Select all
echo "<pre>";
print_r($_POST);
echo "</pre>";
---------------
You don't need ACTION=<?php echo $_SERVER[PHP_SELF]; ?> part. if action parameter is ommitted, the form is posted to the file containing the form (i.e. $_SERVER[PHP_SELF]).rolanddev wrote:Use this code, I corrected it!Code: Select all
<body> <H2>Search Results</H2> <BR> <FORM ACTION=<?php echo $_SERVER[PHP_SELF]; ?> METHOD="POST">