Jump to content

Search the Community

Showing results for tags '$post'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • 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


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 1 result

  1. Hello, I'm running php using classes and here's my dilema. I have a web form that pull data from an MySQL database as a <SELECT> <OPTION> drop down as a while loop; I have two while loops and no problem getting data for each. I have no problem calling the data for the <OPTION> however I need to pull two pieces of information and the <OPTION> from what I know only pulls one. The second while loop from the "sender" table has a "sender_name" & "sender_email". My problem is I can only have one value in the <OPTION> tag but I need to $POST two variables. when I select my drop down which only displays "sender_name" I would like to post "sender_email" so that I can echo this in my functions page for other things. My MySQL table for "sender" has the following: sender_id, sender_name, sender_email Plan is to create an Entry Form > Form Submitted > Data is run and verified on functions page > if Good execute code and send email to sender with details of the entry data... Currently I have it working if I enter a static email address in the mail() function however I would like when the Entry Form is filled out for it to pull the "sender_email" from the associated "sender_name" on that table as a variable to the functions page which has a mail() script Should I be using JavaScript or another PHP function? Thank you in advance, my code below My form: <form method="post" action="form-post.php"> <input type="hidden" name="add-tracking" value="true" /> <input type="hidden" name="tracking_method_id" id="tracking_method_id" value="2" /> <table> <tr> <td><label for="tracking_number">Tracking Number:<br />(No Dashes)</label></td> <td><input type="text" name="tracking_number" id="tracking_number" /></td> </tr> <tr> <td><label for="tracking_recepient">Tracking Recepient:</label></td> <td><input type="text" name="tracking_recepient" id="tracking_recepient" /></td> </tr> <tr> <td><label for="tracking_date">Tracking Date:<br />(YYYY-MM-DD)</label></td> <td><input type="text" name="tracking_date" id="tracking_date" value="<?php echo date('Y-m-d');?>" /></td> </tr> <tr> <td><label for="tracking_cost">Cost $:</label></td> <td><input type="text" name="tracking_cost" id="tracking_cost" value="0.0000" /></td> </tr> <tr> <td><label for="tracking_dept">Dept:</label></td> <td><select name="tracking_dept" id="tracking_dept"> <option value=""></option> <?php $sql = "SELECT * FROM department"; $res = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($res)) { echo '<option value="' . $row['dept_name'] . '">' . $row['dept_name'] . '</option>';} ?> </select></td> </tr> <tr> <td><label for="tracking_requestor">Requested By:</label></td> <td><select name="tracking_requestor" id="tracking_requestor"> <option value=""></option> <?php $sql1 = "SELECT * FROM sender"; $res1 = mysql_query($sql1) or die(mysql_error()); while($row1 = mysql_fetch_assoc($res1)) { echo '<option value="' . $row1['sender_name'] . '" $row1>' . $row1['sender_name'] . '</option>'; } ?> </select></td> </tr> <tr> <td colspan="2"><input type="submit" name="submit" value="Submit" /></td> </tr> </table> </form> My Function function add_tracking($p) { $tracking_id = mysql_real_escape_string($p['tracking_id']); $tracking_number = mysql_real_escape_string($p['tracking_number']); $tracking_recepient = mysql_real_escape_string($p['tracking_recepient']); $tracking_date = mysql_real_escape_string($p['tracking_date']); $tracking_cost = mysql_real_escape_string($p['tracking_cost']); $tracking_dept = mysql_real_escape_string($p['tracking_dept']); $tracking_requestor = mysql_real_escape_string($p['tracking_requestor']); $tracking_method_id = mysql_real_escape_string($p['tracking_method_id']); $tracking_number = preg_replace('/[^a-zA-Z0-9s]/', '', $tracking_number); $headers = ""; $headers .= "From: Anaheim Receiptionist <anaheimreceptionist@powerplus.com>\n"; $headers .= "X-Sender: anaheimreceptionist@powerplus.com\n"; $headers .= "X-Mailer: PHP\n"; $headers .= "X-Priority: 3\n"; $headers .= "Content-Type:text/html; charset=\"iso-8859-1\"\n"; $message = ' <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <style type="text/css"> .right {text-align: right; min-width: 150px;} * {font-family: arial, tahoma, "Times New Roman";} body {font-size: 15px;} #wrap {width:550px; margin: 0 auto;} </style> </head> <body> <div id="wrap"> <p><h1>Your Shipping Item Is Scheduled For Delivery</h1></p> <p><h3>Below Is Your Details:</h3></p> <div style="border: 1px solid #000000;"> <table cellpadding="5"> <tr> <td class="right">Date: </td><td>' . $tracking_date . '</td> </tr> <tr> <td class="right">Sent To: </td><td>' . $tracking_recepient . '</td> </tr> <tr> <td class="right">Tracking Number: </td><td><a href="' . $row1['method_link'] . $tracking_number . '">' . $tracking_number . '</a></td> </tr> <tr> <td class="right">Department No: </td><td>' . $tracking_dept . '</td> </tr> <tr> <td class="right">Sent By: </td><td>' . $tracking_requestor . '</td> </tr> </table> </div> </div> </body> </html> '; if(!$tracking_number || !$tracking_recepient || !$tracking_date || !$tracking_cost || !$tracking_dept || !$tracking_requestor): if(!$tracking_number): echo '<p>The Tracking Number is required</p>'; endif; if(!$tracking_recepient): echo '<p>The Recepient Name is Required</p>'; endif; if(!$tracking_date): echo '<p>The Tracking Date is Required</p>'; endif; if(!$tracking_cost): echo '<p>The Tracking Amount is Required</p>'; endif; if(!$tracking_dept): echo '<p>The Tracking Dept is Required</p>'; endif; if(!$tracking_requestor): echo '<p>The Requested By Name is Required</p>'; endif; echo '<p><a href="tracking-method.php">Try again!</a></p>'; else: $sql = "INSERT INTO tracking VALUES (null, '$tracking_number', '$tracking_recepient', '$tracking_date', '$tracking_cost', '$tracking_dept', '$tracking_requestor', '$tracking_method_id')"; $res = mysql_query($sql) or die(mysql_error()); echo '<p>Added Sucessfully</p>'; echo '<p><img src="ok.png" />'; echo '<p><a href="index.php">Go Back to Tracking # Table</a></p>'; mail($sender_email, 'Your Tracking ID: ' . $tracking_number, $message, $headers); endif; }
  • 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.