Jump to content

Melissafleet

Members
  • Posts

    10
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Melissafleet's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi there I have the following page, which includes a php mail function and sends a few of the fields via email successfully. Once the form is submitted, another page is displayed called 'Thank you'. (?page_id=2561) Question 1: Is there a way to reference all of the fields from the html tables at once in the php script (to email all the fields) or is it necessary to call each fields as I have done with 'companyName' etc? Question 2: How would I include all of the fields 'submitted contents' to display on the 'Thank you' page (?page_id=2561) - as I would like to add a 'print to pdf' button on this page, whereby the user can print the submitted form contents. I would greatly appreciate any advice / direction :) Thank you so much <?php { //send email $email = $_REQUEST['email'] ; $confName = $_REQUEST['conferenceName'] ; $companyName = $_REQUEST['companyName'] ; mail("myemail@yahoo.com", $confName, $companyName, "From:" . $email); } ?> <form method="post" id="quote" action="?page_id=2561"> <script type="text/javascript">// <![CDATA[ jQuery('#quote').keyup(function (){ doTotal(this); calcMenu(this); }); // ]]></script> <table id="table1" border="0" cellspacing="3" cellpadding="3"> <tbody> <tr> <td>Enquiry Date</td> <td> <div align="center"><input type="text" name="dateToday" size="25" /></div></td> </tr> <tr> <td>Conference Name</td> <td> <div align="center"><input type="text" name="conferenceName" size="25" /></div></td> </tr> <tr> <td>Company Name</td> <td> <div align="center"><input type="text" name="companyName" size="25" /></div></td> </tr> <tr> <td>Special Requests</td> <td><textarea name="comment" rows="5" cols="26"></textarea></td> </tr> </tbody> </table> <table id="table2" border="0" cellspacing="3" cellpadding="3"> <tbody> <tr> <td>First Name</td> <td> <div align="center"><input type="text" name="firstName" size="25" /></div></td> </tr> <tr> <td>Last Name</td> <td> <div align="center"><input type="text" name="lastName" size="25" /></div></td> </tr> <tr> <td>Tel No</td> <td> <div align="center"><input type="text" name="telNo" size="25" /></div></td> </tr> <tr> <td>Cell</td> <td> <div align="center"><input type="text" name="cellNo" size="25" /></div></td> </tr> <tr> <td>Email</td> <td> <div align="center"><input type="text" name="email" size="25" /></div></td> </tr> <tr> <td><input onclick="formReset()" type="button" value="Reset form" /></td> </tr> <tr> <td><input type='submit'></td> </tr> </tbody> </table> <table id="tablex" border="1" cellspacing="3" cellpadding="3"> <tbody> <tr> <th scope="col" width="30"> <div align="center">Date</div></th> <th scope="col" width="128"> <div align="center">Amount of Delegates ½ Day Conference @ R 240 pp</div></th> <th width="112"> <div align="center">Amount of Delegates Full Day Conference @ R 260 pp</div></th> <th width="112"> <div align="center">Menu No</div></th> <th width="112"> <div align="center">Price pp for Menu (1-7: R70, 8-10 R85, 11: R105, 12: R85)</div></th> <th width="112"> <div align="center">Total Persons for meals</div></th> <th width="112"> <div align="center">Amount of Single Rooms @ R 480 pp</div></th> <th width="112"> <div align="center">Amount of Double Rooms @ R 720 pp</div></th> <th width="134"> <div align="center">Total for the day</div></th> </tr> <tr> <td> <div align="center"><input type="text" name="date1" size="10" /></div></td> <td> <div align="center"><input type="text" name="halfday1" size="5" maxlength="10" /></div></td> <td> <div align="center"><input type="text" name="fullday1" size="5" /></div></td> <td> <div align="center"><input type="text" name="MenuNo1" size="5" /></div></td> <td> <div align="center"><input type="text" name="MenuPrice1" size="5" /></div></td> <td> <div align="center"><input type="text" name="MealPersons1" size="5" /></div></td> <td> <div align="center"><input type="text" name="SingleRooms1" size="5" /></div></td> <td> <div align="center"><input type="text" name="DoubleRooms1" size="5" /></div></td> <td> <div align="center"><input type="text" name="total1" size="5" /></div></td> </tr> <tr> <td> <div align="center"><input type="text" name="date2" size="10" /></div></td> <td> <div align="center"><input type="text" name="halfday2" size="5" /></div></td> <td> <div align="center"><input type="text" name="fullday2" size="5" /></div></td> <td> <div align="center"><input type="text" name="MenuNo2" size="5" /></div></td> <td> <div align="center"><input type="text" name="MenuPrice2" size="5" /></div></td> <td> <div align="center"><input type="text" name="MealPersons2" size="5" /></div></td> <td> <div align="center"><input type="text" name="SingleRooms2" size="5" /></div></td> <td> <div align="center"><input type="text" name="DoubleRooms2" size="5" /></div></td> <td> <div align="center"><input type="text" name="total2" size="5" /></div></td> </tr> <tr> <td> <div align="center"><input type="text" name="date3" size="10" /></div></td> <td> <div align="center"><input type="text" name="halfday3" size="5" /></div></td> <td> <div align="center"><input type="text" name="fullday3" size="5" /></div></td> <td> <div align="center"><input type="text" name="MenuNo3" size="5" /></div></td> <td> <div align="center"><input type="text" name="MenuPrice3" size="5" /></div></td> <td> <div align="center"><input type="text" name="MealPersons3" size="5" /></div></td> <td> <div align="center"><input type="text" name="SingleRooms3" size="5" /></div></td> <td> <div align="center"><input type="text" name="DoubleRooms3" size="5" /></div></td> <td> <div align="center"><input type="text" name="total3" size="5" /></div></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> </tr> </tbody> </table> </form>
  2. Thank you. I changed the name of the page to the file mentioned, and the "thank you" text now appears and the mail sends. However only the subject is appearing in the mail, and not the text which was typed into the 'message' field? <?php if (isset($_REQUEST['email'])) //if "email" is filled out, send email { //send email $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail("myemail@yahoo.com", $subject, $message, "From:" . $email); echo "Thank you for using our mail form"; } else //if "email" is not filled out, display the form { echo "<form method='post' action='?page_id=2533.php'> Email: <input name='email' type='text'><br> Subject: <input name='subject' type='text'><br> Message:<br> <textarea name='message' rows='15' cols='40'> </textarea><br> <input type='submit'> </form>"; } ?>
  3. Hi there I am trying to use the php mail function, but I am receiving this error: The requested URL /mailform.php was not found on this server. PHP <?php if (isset($_REQUEST['email'])) //if "email" is filled out, send email { //send email $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail("myemail@yahoo.com", $subject, $message, "From:" . $email); echo "Thank you for using our mail form"; } else //if "email" is not filled out, display the form { echo "<form method='post' action='mailform.php'> Email: <input name='email' type='text'><br> Subject: <input name='subject' type='text'><br> Message:<br> <textarea name='message' rows='15' cols='40'> </textarea><br> <input type='submit'> </form>"; } ?> ( I replaced my email address with "myemail@yahoo.com" just for the forum... Thank you
  4. Hi Barand. Yes it is in a file of it's own. I edited the path a bit, as I noticed that my folder was named differently to yours, and now it looks as if it is starting to create the document, but then It says " Failed to load PDF" document? Thank you for your reply <?php define('TEMPLATEPATH','c:/fpdf17'); // <--- added this require(TEMPLATEPATH . '/fpdf.php'); $pdf = new FPDF('P','mm','A4'); $pdf->AddPage(); $pdf->SetFont('Arial','B',16); $pdf->Cell(0,10,'PHP - The Good Parts!'); $pdf->Output(); ?>
  5. The content is supposed to output the text "The Good Parts". I have tried it again, and not it displays a message that says "Failed to load PDF document" ?
  6. It's in a Wordpress page on its own. I have installed a plugin that allows me to insert php directly in the page code editor (exec-php) http://bluesome.net/post/2005/08/18/50/
  7. I am using Wordpress, so I thought that it would find the location of FPDF automatically using TEMPLATEPATH... I assume that is incorrect? Should I replace your path (c:/php).. etc with the direct path to that file in my cPanel? Thank you so much for your help
  8. Thank you. I have removed the spaces (line spaces) in between but am still receiving the error? <?php require(TEMPLATEPATH . '/fpdf.php'); $pdf = new FPDF('P','mm','A4'); $pdf->AddPage(); $pdf->SetFont('Arial','B',16); $pdf->Cell(0,10,'PHP - The Good Parts!'); $pdf->Output(); ?> Thank you
  9. I have installed the FPDF library, and inserted this in the page: <?php require(TEMPLATEPATH . '/fpdf.php'); $pdf = new FPDF('P','mm','A4'); $pdf->AddPage(); $pdf->SetFont('Arial','B',16); $pdf->Cell(0,10,'PHP - The Good Parts!'); $pdf->Output(); ?> It starts creating the pdf, but then an error pops up saying "file does not begin with '%PDF' ? What could be causing this error?
  10. :'( Hi PLease can someone perhaps assist me with the following? (perhaps if you could even respond to only one item on the below, I would be most grateful please:? Thank you I have created a php form (which i inserted into wordpress site) www.lookinside.co.za/wp - under "Conferences" tab... This form is working well, I just have a couple of changes which I would like to make, and am not sure how. if someone could perhaps maybe even help with one of the items on here I would be extremely grateful please :-) Changes: 1. is it possible to have a "print" button to appear on the page that comes up after submitting the quote? 2. Can we insert a "date" field possibly with a calendar popup to select a date for the conference? 3. Can images and other text appear on the "after submission" page? that will then also print, ie: info about the conference rooms, images? 4. Can the no. of people calculate as the number is entered? not seem to be working... 5. when the submitted form is emailed through / and viewed, is it possible to include the title of the duration? ie at the moment it shows as: "Duration: R200", can we make it "Duration: Full Day - R200" or something? THe same for the "menu selection" <?php if(isset($_POST['action']) && $_POST['action'] == "submit_post"): ?> <?php $string = "Customer Name: ". $_POST['name']. "\n"; $string .= "Company: ". $_POST['company']. "\n"; $string .= "Conference Name: ". $_POST['field-36b58f8c5142ff3']. "\n"; $string .= "Telephone Number: ". $_POST['field-7c496d0fb21abfd']. "\n"; $string .= "Duration: ". $_POST['field-385963a5c9a4ef9']. "\n"; $string .= "Number of People: ". $_POST['field-5af722f60ee2f9b']. "\n"; $string .= "Menu: ". $_POST['menu']. "\n"; $string .= "Overhead Projector: ". $_POST['field-73cf21adf8b52d5']. "\n"; $string .= "Email: ". $_POST['field-3f92f5a7876cd50']. "\n"; $string .= "Sub Total: ". $_POST['totalcost']. "\n"; print "<p>". nl2br($string) ."</p>"; $to = $_POST['field-3f92f5a7876cd50'] . ", "; //This is the users email address $to .= "melissafleetwood@yahoo.com" . ", "; //Put your first email here $to .= "melissa@run-time.co.za"; //Put your second email here $subject = "Reciept confirmation"; $headers = "From: melissa@lookinside.co.za"; mail($to, $subject, $string, $headers); ?> <?php else: ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Contact Form Test</title> </head> <body> <form action="" method="post"> <div> <input type="hidden" name="action" id="acctid" value="submit_post" /> </div> <table cellspacing="5" cellpadding="5" border="0"> <td valign="top"> <strong>Name of Contact Person:</strong> </td> <td valign="top"> <input type="text" name="name" id="name" size="40" value="" /> </td> </tr> <tr> <td valign="top"> <strong>Company:</strong> </td> <td valign="top"> <input type="text" name="company" id="company" size="40" value="" /> </td> </tr> <tr> <td valign="top"> <strong>Official Name Of Conference</strong> </td> <td valign="top"> <input type="text" name="field-36b58f8c5142ff3" id="field-36b58f8c5142ff3" size="40" value="" /> </td> </tr> <tr> <td valign="top"> <strong>Tel No Of Contact Person:</strong> </td> <td valign="top"> <input type="text" name="field-7c496d0fb21abfd" id="field-7c496d0fb21abfd" size="40" value="" /> </td> </tr> <tr> <td valign="top"> <strong>Duration:</strong> </td> <td valign="top"> <input type="radio" name="field-385963a5c9a4ef9" id="game4" value="220.00" onclick="UpdateCost()"> Full Day R220.00<br/> <input type="radio" name="field-385963a5c9a4ef9" id="game5" value="200.00" onclick="UpdateCost()"> Half Day R200.00<br/> </td> </tr> <tr> <td valign="top"> <strong>No Of People</strong> </td> <td valign="top"> <input type="text" name="field-5af722f60ee2f9b" id="field-5af722f60ee2f9b" size="40" value="" onchange="UpdateCost()"/> </td> </tr> <tr> <td valign="top"> <strong>Please select a menu:</strong> </td> <td valign="top"> <input type="radio" name="menu" id='game0' value="60.00" onclick="UpdateCost()">Menu A (60.00)<br> <input type="radio" name="menu" id='game1' value="90.00" onclick="UpdateCost()">Menu B (90.00)<br> <input type="radio" name="menu" id='game2' value="120.00" onclick="UpdateCost()">Menu C (120.00)<br> <input type="radio" name="menu" id='game3' value="150.00" onclick="UpdateCost()">Braai/Barbeque (150.00)<br> </td> </tr> <tr> <td valign="top"> <strong>Overhead Projector</strong> </td> <td valign="top"> <input type="checkbox" name="field-73cf21adf8b52d5" id="game6" value="650.00" onclick="UpdateCost()">R650.00 <br/> </td> </tr> <tr> <td valign="top"> <strong>Email of Contact Person: </strong> </td> <td valign="top"> <input type="text" name="field-3f92f5a7876cd50" id="field-3f92f5a7876cd50" size="40" value="" /> </td> <tr> <td valign="top"> <strong>Sub Total: </strong> </td> <td valigh="top"> <input type="text" id="totalcost" name="totalcost" size="40" value=""> </td> <tr> <td colspan="2" align="center"> <input type="submit" value=" Submit Form " /> </td> </tr> </form> <script type="text/javascript"> function UpdateCost() { var sum = 0; var gn, elem, totalAmmount, peopleNum; for (i=0; i<7; i++) { gn = 'game'+i; if(gn != 'game6'){ elem = document.getElementById(gn); if (elem.checked == true) { sum += Number(elem.value); } } peopleNum = document.getElementById('field-5af722f60ee2f9b').value; if(isNaN(peopleNum ) || peopleNum==''){ totalAmmount = sum; } else{ totalAmmount = sum * peopleNum; } } if(document.getElementById('game6').checked == true) { totalAmmount += Number(document.getElementById('game6').value); } document.getElementById('totalcost').value = totalAmmount.toFixed(2); } </script> <script type="text/javascript"> var value=""; var numPeople=document.getElementById("field-5af722f60ee2f9b") numPeople.onkeydown=function(e){ value = this.value + e; } numPeople.onkeyup=function(e) { this.value=this.value.replace(/[^\d]/,''); if(this.value != value) { UpdateCost(); } } </script> </body> </html> <?php endif; ?> Javascript: /* This script and many more are available free online at The JavaScript Source!! http://javascript.internet.com Created by: Jay Rumsey | http://www.nova.edu/~rumsey/ */ function UpdateCost() { var sum = 0; var gn, elem, totalAmmount, peopleNum; for (i=0; i<7; i++) { gn = 'game'+i; if(gn != 'game6'){ elem = document.getElementById(gn); if (elem.checked == true) { sum += Number(elem.value); } } peopleNum = document.getElementById('field-5af722f60ee2f9b').value; if(isNaN(peopleNum ) || peopleNum==''){ totalAmmount = sum; } else{ totalAmmount = sum * peopleNum; } } if(document.getElementById('game6').checked == true) { totalAmmount += Number(document.getElementById('game6').value); } document.getElementById('totalcost').value = totalAmmount.toFixed(2); } Thank you
×
×
  • 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.