Jump to content

PHP form, $_GET, & $_POST


myotch

Recommended Posts

My form values are not posting on my thankyou.php page.  I'm sure it's a simple fix.

 

Here's some code from reservation.php .

form action="CGI/gdform.php" method="post" enctype="application/x-www-form-urlencoded" name="formres" id="formres">
    <input type="hidden" name=" redirect" value="ThankYou.php">
   <label><span class="style12">Your Name:
   <input type="text" name="txtName" id="Name" />
   </span></label>
  ...
<p class="style12"><span id="sprytextfield10">
   <label>Date of Special Event:
   <input type="text" name="DateReq" id="DateReq" />
   </label>
<?php 
	$txtName = $_GET[txtName];
	...
	$DateReq = $_GET[DateReq];
?>
</form>

 

On my thankyou.php:

<body>

<?php
	$txtName = $_POST[txtName];
	...
	$DateReq = $_POST[DateReq];

?>

 

and a little lower down...

<?php echo $txtName ?>
...
<?php echo $DateReq ?>

 

Any reason why the thank you page isn't calling the values?  I exhaustively checked it against a working form I have on another site, and the code seems to be, well, identical.

 

Not getting an error, just get empty space where the values should be.

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/225427-php-form-_get-_post/
Share on other sites

Your post makes 0 sense.  There is no evidence here to suggest that the pages interact with each other in any way. You are showing `reservation.php` which links to `gdform.php`(not shown), with NO link to `thankyou.php`.  There are parse errors (...) as well.

 

If we could see each page, we might be able to help... a little ;)

Link to comment
https://forums.phpfreaks.com/topic/225427-php-form-_get-_post/#findComment-1164094
Share on other sites

Your post makes 0 sense.  There is no evidence here to suggest that the pages interact with each other in any way. You are showing `reservation.php` which links to `gdform.php`(not shown), with NO link to `thankyou.php`.  There are parse errors (...) as well.

 

If we could see each page, we might be able to help... a little ;)

 

There's a hidden input redirect on line 2 of the code supplied.

Link to comment
https://forums.phpfreaks.com/topic/225427-php-form-_get-_post/#findComment-1164098
Share on other sites

Your post makes 0 sense.  There is no evidence here to suggest that the pages interact with each other in any way. You are showing `reservation.php` which links to `gdform.php`(not shown), with NO link to `thankyou.php`.  There are parse errors (...) as well.

 

If we could see each page, we might be able to help... a little ;)

 

There's a hidden input redirect on line 2 of the code supplied.

 

re-directs don't happen through hidden inputs.

Link to comment
https://forums.phpfreaks.com/topic/225427-php-form-_get-_post/#findComment-1164102
Share on other sites

$txtName = $_POST[txtName];
	...
	$DateReq = $_POST[DateReq];

 

Enclose txtName and DateReq in quotes, otherwise it assumes it's a constant. That goes for all cases. See if that fixes it.

 

OK, it is fixed now.

 

I took the reservation form, and had it go to a confirmation page.  The confirmation page's form action is to the form mailer script (gdform.php), and a hidden redirect to the thankyou page sending the called echoed values from a hidden table within the form upon the click of the submit button labeled "Confirm".

 

Workin' pretty charmy.

 

If you want to see it in action, it is at http://www.artisanrestaurants.com.  Did a similar thing with http://www.minidoss.com last year.

Link to comment
https://forums.phpfreaks.com/topic/225427-php-form-_get-_post/#findComment-1164148
Share on other sites

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.