RE: form submition problem

  • From: "Andy B" <a_borka@xxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 28 Oct 2007 20:03:31 -0400



Just looking at it right away, in your <form method="post"> tag, you are
missing the action field. It should look something like this: <form
action=<? $_SERVER['PHP_SELF']?> method="post">. That would all depend of
course on what version of php you use and if you are going to be using an
external php script or not. If you are posting back to the same file the
form is in, I would recommend looking at the $_SERVER variables in the php


From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of The Ice Master
Sent: Sunday, October 28, 2007 7:23 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: php: form submition problem


I'm wondering if someone could point out to me what it is I've done wrong
with this code that is causing it to not behave as expected.  

The issue I'm having is this: it displays the form, but when you hit the
submit button which in this case is labeled continue rather than go to the
next step like I would expect it to, it displays the form again.  

Below is the code:




Accept a user name and product ID
for the E.M.P. product indicated.
In order that a registration key may be generated
and sent to the e-mail provided
once the user's payment has been received.


function DisplayHeader($title){
// include the main header file.


// include the nav links.


// set main content ancre
// Note: this is the location moved to by the skip nav links link.
print <<<here
<A NAME="skip"></A>


function ShowForm(){
print <<<here
<form method="post">
<p>Product name:<br>
<input type="text" name="ProductName" value=""></p>
<p>Product ID:<br>
<input type="text" name="ProductID" value="{$_GET['ProductID']}"></p>
<p>User name (Software will be registered to this name):<br>
<input type="text" name="UserName" value=""></p>
<p>Your e-mail address (Please make sure this address is correct as the
registration key will be sent to this address.):<br>
<input type="text" name="email" value=""></p>
<input type="submit" name="sendit" value="Continue">


function ShowPayPal(){
// First e-mail their User name and Product ID to E.M.P. Sales.
if(EmailUserInformation($_POST['ProductName'], $_POST['ProductID'],
$_POST['UserName'], $_POST['email'])){
// Show the email sent, now for payment screen.
$paypal = <<<here
Thanks, your information has been sent.  <br>
All that is left now is to complete your Paypal payment.  <br>
After that, you will receive your registration Key via e-mail.  <br>
To complete your paypal payment use the button provided below.  <br>
<!-- actual page contains paypal button code here -->

return $paypal;


function EmailUserInformation($pn, $pid, $un, $ue){
$to = 'Eldridge Multidimensional Programming Sales
<sales@xxxxxxxxxxxxxxxxxxxxxxx <mailto:sales@xxxxxxxxxxxxxxxxxxxxxxx%3e'>
$subject = 'Registration Key Request';
$message = <<<here
Hi, I'd like a registration key for $pn\n
My user name is: $un\n
and my product ID is: $pid\n
You can send it to: $ue\n


// Additional headers
$headers = "From: $un <$ue>" . "\r\n".
"Reply-To: $ue" . "\r\n".
"X-Mailer: PHP/" . phpversion();


$sendMsg = mail($to, $subject, $message, $headers);
return $sendMsg;


function DisplayFooter(){
// Include the nav links.


// Include the footer.


// call the above functions in the correct order to show the page.
DisplayHeader("Purchase Software Registration Key");


// Show the form if the user hasn't filled out the information yet.
echo ShowPayPal();






end code


My thanks in advance for any help that is offered.  I have a feeling this is
something easy and obvious that I'm just over looking, but I could be wrong.
If so, I have just been looking at this code so long I'm not seeing it  


e>  Ice Master
** Programmers don't repeat themselves, they loop! **

Looking for an awesome Internet radio station? If so, visit:
My show is Sundays from Noon to 2 pm eastern time.

Other related posts: