php: form submition problem

  • From: "The Ice Master" <totallyicedover@xxxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 28 Oct 2007 19:22:48 -0400

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:

<?php

/*
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("header.php");

// include the nav links.
include("navlinks.php");

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

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>
<p>
<input type="submit" name="sendit" value="Continue">
</p>
</form>
here;
}

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
<p>&nbsp;</p>
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>
<p>&nbsp;</p>
<!-- actual page contains paypal button code here -->
 here;
return $paypal;
}
}

function EmailUserInformation($pn, $pid, $un, $ue){
$to = 'Eldridge Multidimensional Programming Sales 
<sales@xxxxxxxxxxxxxxxxxxxxxxx>';
$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
here;

// 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("navlinks.php");

// Include the footer.
include("footer.php");
}

// 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.
if(!$sendit){
ShowForm();
}else{
echo ShowPayPal();
}

DisplayFooter();

?>

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  


Regards,
The Ice Master
** Programmers don't repeat themselves, they loop! **


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

Other related posts:

  • » php: form submition problem