Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP + form issues

Status
Not open for further replies.

khanza

Technical User
Feb 20, 2003
70
US
After this script sends me an email with these people's info, I want it to automatically take them to a paypal pay site.

Here's what I have --
Code:
<html>
<?php
if ($_POST['submit']){
  $to = "myemail@email.com";
  $subject = $_POST['name'];
  $body = $_POST['name'].",".$_POST['address'].",".$_POST['city'].",".$_POST['zip'].",".$_POST['phone'].",".$_POST['email'].",".$_POST['preference'].",".$_POST['pass'];
  if (mail($to, $subject, $body)){
    echo("<p>Message sent!</p>");
    echo"<body onload=\"document.form1.submit()\">";
    echo"<form action=\"https:\/\/[URL unfurl="true"]www.paypal.com/cgi-bin/webscr\"[/URL] method=\"post\">;
    echo"<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">";
    echo"<input type=\"hidden\" name=\"business\" value=\"myemail@email.com\">";
    echo"<input type=\"hidden\" name=\"item_name\" value=\"Pass\">";
    echo"<input type=\"hidden\" name=\"item_number\" value=\"123\">";
    echo"<input type=\"hidden\" name=\"no_note\" value=\"1\">";
    echo"<input type=\"hidden\" name=\"currency_code\" value=\"USD\">";
    echo"<input type=\"hidden\" name=\"lc\" value=\"US\">";
    echo"</form>";
  }
  else{
    echo("<p>Message delivery failed...</p>");
  }
}
?>
</html>

The error is -
Code:
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/w/waterski4life/.html/php-form-dance/tekconfirm.php on line 11
 
That is why I never use double quotes (") to delimit a string that contains double quotes. Use single quotes.

Which of these is more readable:
Code:
echo "<form action=\"https:\/\/[URL unfurl="true"]www.paypal.com/cgi-bin/webscr\"[/URL] method=\"post\">";
Code:
echo '<form action="[URL unfurl="true"]https://www.paypal.com/cgi-bin/webscr"[/URL] method="post">';

Double quotes are good if you want to evaluate a varible or the string you're quoting contains a single quote (').

Ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top