Jump to content

Search the Community

Showing results for tags 'get url'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Help Please! I'm trying to pass variables in a URL and use them in a HTML email. When test1.php calls Test2.php, test2.php should send two HTML emails but nothing happens. I get this error for test2.php: [24-Feb-2016 16:20:42 UTC] PHP Parse error: syntax error, unexpected end of file in /home/my/public_html/test2.php on line 114 HTML - call test1.php <!DOCTYPE html> <html lang="en-US"> <head> <meta charset="utf8" /> <title>Testform.html</title> </head> <body bgcolor="tan" text ="black"> <form action="test1.php" method="POST" > <table> <tr> <th> ~ Test ~ <br /> </th> </tr> </table> <br /> <table> <tr> <td> * </td> <td> <strong> Required Fields </strong> </td> <tr> </table> <table> <tr> <td> <strong>Title: </strong> </td> <td> <select name="Title" size="1" > <option value="" selected>Please Choose</option> <option value="Mr."> Mr.</option> <option value="Ms."> Ms.</option> <option value="Mrs."> Mrs.</option> </select> </td> </tr> <tr> <td> <strong> First Name: </strong> </td> <td> <input type="text" name="Fname" maxlength="30" /> </td> </tr> <tr> <td> <strong> Last Name: </strong> </td> <td> <input type="text" name="Lname" maxlength="30" /> </td> </tr> <tr> <td> <strong> Suffix: </strong> </td> <td> <select name="Suffix" size="1"> <option value=""> Please Choose </option> <option value="Sr."> Sr.</option> <option value="Jr."> Jr.</option> <option value="III"> III</option> <option value="IV"> IV</option> <option value="V, "> V</option> </select> </td> </tr> <tr> <td> <strong> Address: </strong> </td> <td> <input type="text" name="Address" maxlength=40 /> </td> </tr> <tr> <td> <strong> City, State: </strong> </td> <td> <select name="CityState"> <option value=""> Please Choose </option> <option value="Hometown, CA"> Hometown, CA</option> <option value="My City, CA"> My City, CA</option> <option value="Beautiful, CA"> Beautiful, CA</option> </select> </td> </tr> <tr> <td> <strong> Zip Code: </strong> </font> </td> <td class="td2"> <input type="text" name="Zip" placeholder="99999" maxlength=10 /> </td> </tr> </table> <table> <tr> <th> <strong> Comments: </strong> </th> </tr> </table> <table> <tr> <td> <textarea rows="8" cols="60" name="Comments" wrap="hard"> </textarea> </td> </tr> </table> <table> <tr> <td> <input id="shiny" type="submit" value="Submit Form" /> </td> </tr> </table> </form> </body> </html> TEST1.PHP <?php //###Process testform.html //### Error Reporting error_reporting(E_ALL); //### Create Random Number srand((double) microtime() * 1000000); //### Define Variable(s) $random_number = rand(); $Test_number = "$random_number"; $Date = date("D d M Y - H:i:s "); $path = "/home/mypath/public_html/"; $myfile = "test1.txt"; $file = $path.$myfile; $fh = fopen($file, "a+") or die("Couldn't open $myfile"); //### Get Data From Form if ($_SERVER["REQUEST_METHOD"] === "POST") { if(isset($_POST["Title"])) { $Title = $_POST["Title"]; } if(isset($_POST["Fname"]) && !empty ($_POST["Fname"])) { $Fname = $_POST["Fname"]; if(preg_match("/[^a-zA-Z]*$/",$Fname)){ //### Upper Case First Letter of First Name $FnameUc = ucfirst($Fname); } else { echo"<strong>The First Name you entered is not valid.</strong>". PHP_EOL; echo "<br />\n"; exit; } } if(isset($_POST["Lname"]) && !empty ($_POST["Lname"])) { $Lname = $_POST["Lname"]; if(preg_match("/[^a-zA-Z]*$/",$Lname)){ //### Upper Case First Letter of Last Name $LnameUc = ucfirst($Lname); } else { echo"<strong>The Last Name you entered is not valid.</strong>". PHP_EOL; echo "<br />\n"; exit; } } if(isset($_POST["Suffix"]) && !empty ($_POST["Suffix"])) { $Suffix = $_POST["Suffix"]; } if(isset($_POST["Address"]) && !empty ($_POST["Address"])) { $Address = $_POST["Address"]; } else { echo "<br />\n"; } if(isset($_POST["CityState"]) && !empty ($_POST["CityState"])) { $CityState = $_POST["CityState"]; } else { echo " <strong> You didn't choose a City, State </strong> "; echo " <br /> "; die(); } if(isset($_POST["Zip"]) && !empty ($_POST["Zip"])) { $Zip = $_POST["Zip"]; } else { echo "<strong>You didn't enter Zip Code</strong>"; echo " <br /> "; die(); } if(isset($_POST["Email"]) && !empty ($_POST["Email"])) { $Email = trim($_POST["Email"]); //### check if e-mail address is well-formed if (!filter_var($Email, FILTER_VALIDATE_EMAIL)) { echo $Email . " <strong>is not a valid email address</strong>"; } } } //### Call Functions test1_1(); test1_2(); function test1_1(){ //### Write order to file appointment.txt global $Test_number, $Date, $Title, $FnameUc, $LnameUc, $Suffix, $Address, $CityState, $Zip, $Email, $Comments; if(is_readable($file)) { echo " "; } else { echo '<strong>The file is not readable</strong>\n\n'; die(); } if(is_writable($file)) { echo " "; } else { echo '<strong>The file is not writable</strong>'; die(); } //### Open file if(!$fh) { die("couldn't open file <i>$myFile</i>"); } else { $str = "\r\n"; $str.= "Test1 - $Test_number\r\n"; $str.= "Date: $Date\r\n"; $str.= "Name:\r\n"; $str.= "\t\t $Title $FnameUc $LnameUc $Suffix\r\n"; $str.= "Address:\r\n"; $str.= "\t\t $Address\r\n"; $str.= "City, State:\r\n"; $str.= "\t\t $CityState $Zip\r\n"; $str.= "\t\t $Email \r\n"; $str.= "Comments:\r\n"; $str.= "\t\t $Comments\r\n"; $str.= "\r\n"; $str.= "\r\n"; fwrite($fh, $str); } fclose($fh); } function test1_2() { //### Email (HTML) Someone global $Test_number, $Date, $Title, $FnameUc, $LnameUc, $Suffix, $Address, $CityState, $Zip, $Email, $Comments; //### Define Variables $mailto = $Email; $From = "me@mydomain.com"; $subject = "Test1"; //### Beginning of HTML message $message = <<<EOF <html> <body BGCOLOR="tan" TEXT="black"> <br><br> $Title $LnameUc, <br> We have received your Test. <br> The information you submitted is below: <br> <b>$Title $FnameUc $LnameUc $Suffix</b> <br> <b>$Address</b> <br> <b>$CityState $Zip</b> <br> <b>$Email</b> <br><br> Comments: <br> <b>$Comments</b> <br><br> Please click your <b><u>Confirm Email Address</u></b> ,below, to confirm your email address. <br><br> * * * * * * * * * * <a href="http://www.mydomain.com/test2.php?test_number= $Test_number&date=$Date&title=$Title&fname=$FnameUc&lname=$LnameUc&suffix=$Suffix&address=$Address&citystate= $CityState&zip=$Zip&email=$Email&comments=$Comments">Confirm Email Address - $Test_number</a> * * * * * * * * * * <br><br> </body> </html> EOF; //end of message $headers = "Mime-Version: 1.0" . "\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1" ."\r\n"; $headers .= "Sensitivity: Personal\r\n"; $headers .= "From:" .$From . "\r\n"; $headers .= "Reply To:". $From . "\r\n"; $headers .= "Return-Path:" .$From . "\r\n"; $headers.= "BCC: me@mydomain.net\r\n"; $headers .= "X-Priority: 1 (Highest)\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; $headers .= "Importance: High\r\n"; //### now lets send the email if(mail($mailto, $subject, $message, $headers)) { echo "<b> <font color='green' size='+2'> Test1 sent.</font></b>"; } else { echo "<b> <font color='red' size='+2'>Test1 not sent.</b></font>"; } } ?> TEST2.PHP <?php //### Test2.php called by Test1.php //### Error Reporting error_reporting(E_ALL); //### Define varibles $Date = $_GET["date"]; $Appointment_number = $_GET["appointment_number"]; $Title = $_GET["title"]; $FnameUc = $_GET["fname"]; $LnameUc = $_GET["lname"]; $Suffix = $_GET["suffix"]; $Address = $_GET["address"]; $CityState = $_GET["citystate"]; $Zip = $_GET["zip"]; $Email = $_GET["email"]; $Comments = $_GET["comments"]; //### Call Function(s) test2_1(); test2_2(); //### HTML Email to Client function test2_1() { global $Date, $Test_number, $Title, $FnameUc, $LnameUc, $Suffix, $Address, $CityState, $Zip, $Email, $Comments; //### Define variables $mailto = $Email; $From = "me@mydomain.com"; $subject = "Test2 - ". $Test_number."\r\n"; //### Beginning of HTML message $message = <<<EOF <html> <body BGCOLOR="tan" TEXT="black"> <br><br> $Title $FnameUc $LnameUc $Suffix <br> Your email address <b><$mailto></b> is confirmed. <br><br> </body> </html> EOF; //### end of message $headers = "Mime-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "Sensitivity: Personal\r\n"; $headers .= "From: ".$From. "\r\n"; $headers .= "Reply-To: ".$From. "\r\n"; $headers .= "Return-Path: ".$From. "\r\n"; $headers .= "BCC: horacef@horacefranklinjr.net \r\n"; $headers .= "X-Priority: 1 (Highest)\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; //### Now lets send the email if(mail($mailto, $subject, $message, $headers)) { echo "<b> <font color='green' size='+2'>Email address Confirmation sent to: ".$mailto."</font></b>"; echo "<br /> <br />"; } else { echo "<b> <font color='red' size='+2'>Email address Confirmation not sent.</font></b>"; echo "<br /> <br />"; } } //### HTML Email to Horace function test2_2() { global $Date, $Appointment_number, $Title, $FnameUc, $LnameUc, $Suffix, $Address, $CityState, $Zip, $Email, $Comments; //### Define variables $mailto = $Email; $From = "me@mydomain.com"; $subject = "Test2 - ". $Test_number."\n\n"; //### begin of HTML message $message = <<<EOF <html> <body BGCOLOR="tan" TEXT="black"> <br><br> You have received an Test, <b>that needs to be confirmed.</b> <br> Date Received: <b>$Date</b> <br><br> The information submitted is below: <br> <b>$Title $FnameUc $LnameUc $Suffix</b> <br> <b>$Address</b> <br> <b>$CityState $Zip</b> <br> <b>$mailto</b> <br><br> Comments: <br> <b>$Comments</b> <br><br> Please click the <b><u>Confirm Appointment</u></b> ,below, to confirm the Appointment Date and Time. <br><br> <a href="http://www.mydomain.com/Test3.php?date=$Date&test_number=$Test_number&title=$Title&fname=$FnameUc&lname=$LnameUc&suffix=$Suffix&address=$Address&citystate=$CityState&zip=$Zip&email=$Email&comments=$Comments"> Confirm Appointment - $Test_number</a> <br> </body> </html> EOF; //###end of message $headers = "Mime-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "Sensitivity: Personal\r\n"; $headers .= "From:" . $From . "\r\n"; $headers .= "Reply-To:" . $From . "\r\n"; $headers .= "Return-Path:" . $From . "\r\n"; $headers .= "BCC: me@mydomain.net\r\n"; $headers .= "X-Priority: 1 (Highest)\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; //### Now lets send the email if(mail($mailto, $subject, $message, $headers)){ echo "<b> <font color='green' size='+2'> Confirm Appointment email sent to: ". $mailto."</b></font>"; echo "<br /> <br />"; } else { echo "<b> <font color='red' size='+2'> Confirm Appointment email not sent.</b></font>"; echo "<br /> <br />"; } ==> Line 114 }
×
×
  • 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.