usarmy Posted January 7, 2007 Share Posted January 7, 2007 I'm pretty new to PHP and need some help with this code. How do I put line breaks into the email message. and the name of the field that goes with the information sent.<?phpif (isset($_REQUEST['email']))//if "email" is filled out, send email { //send email $email = $_REQUEST['email'] ; $subject = "Requested Quote" ; $message = $_REQUEST['message'] ; $firstname = $_REQUEST['firstname']; $lastname = $_REQUEST['lastname']; $comname = $_REQUEST['companyname']; $comsite = $_REQUEST['companysite']; $address = $_REQUEST['address']; $zipcode = $_REQUEST['zipcode']; $product = $_REQUEST['product']; $size = $_REQUEST['size']; $quantity = $_REQUEST['quantity']; mail( "[email protected]", "$subject",$firstname . $lastname . $comname . $comsite . $address . $zipcode . $product . $size .$quantity . $message, "From: $email" ); echo "Thank you for your interest in Sleeper Media Products"; }?> <form method='post' action='Request.php'> <?php $product = $_REQUEST['product'] ?> <h1> Thank You for choosing a Sleeper Media <?php echo $product ?></h1> <p> </p> <table width="315" border="1"> <tr> <td><b>Email:</b></td> <td><input name='email' type='text' /></td> </tr> <tr> <td><b>Subject:</b></td> <td><input name='subject' type='text' value="Requested Quote" /></td> </tr> <tr> <td><b>First Name:</b></td> <td><input name='firstname' type='text' /></td> </tr> <tr> <td><b>Last Name:</b></td> <td><input name='lastname' type='text' /></td> </tr> <tr> <td><b>Company Name:</b></td> <td><input name='companyname' type='text' /></td> </tr> <tr> <td><b>Company Site:</b></td> <td><input name='companysite' type='text' /></td> </tr> <tr> <td><b>Address:</b></td> <td><input name='address' type='text' /></td> </tr> <tr> <td><b>Zip Code:</b></td> <td><input name='zipcode' type='text' /></td> </tr> <tr> <td><b>Product:</b></td> <td><input name='product' type='text' value="<?php echo $product?>" /></td> </tr> <tr> <td><b>Size:</b></td> <td><input name='size' type='text' /></td> </tr> <tr> <td><b>Quantity:</b></td> <td><input name='quantity' type='text' /></td> </tr> <tr> <td><b>Instructions:</b></td> <td><textarea name='message' rows='8' cols='40'> </textarea></td> </tr> </table> <br /> <input type='submit' /> </form>Any help would be great! Link to comment https://forums.phpfreaks.com/topic/33225-need-some-help-with-php-script/ Share on other sites More sharing options...
HoTDaWg Posted January 7, 2007 Share Posted January 7, 2007 [code]<?phpif (isset($_REQUEST['email']))//if "email" is filled out, send email { //send email $email = $_REQUEST['email'] ; $subject = "Requested Quote" ; $message = $_REQUEST['message'] ; $firstname = $_REQUEST['firstname']; $lastname = $_REQUEST['lastname']; $comname = $_REQUEST['companyname']; $comsite = $_REQUEST['companysite']; $address = $_REQUEST['address']; $zipcode = $_REQUEST['zipcode']; $product = $_REQUEST['product']; $size = $_REQUEST['size']; $quantity = $_REQUEST['quantity']; mail( "[email protected]", "$subject",$firstname .$lastname .$comname .$comsite .$address .$zipcode .$product .$size .$quantity .$message, "From: $email" ); echo "Thank you for your interest in Sleeper Media Products"; } [/code]well, i dont mean to be mean, but u have a lot of errors. well, they are not errors, it is just that [b]the way[/b] you organized this script is kind of interesting. Lemme show you what to do, but since you have so many fields, i cant make a script for all of them. just a few.[code]<?phpif(isset($_POST['submit'])){$email= $_POST['email'];$firstname= $POST['firstname'];//do this for all the fields. then: if(empty['$email']){ echo "You left the email field blank, punk"; }else{ mail( "[email protected]", "$subject","$message","$firstname","$andsoforth", }}else{$product = $_REQUEST['product']echo "<h1>Thank You for choosing a Sleeper Media".$product."</h1>";echo ("<form method='post' action=""> <p> </p> <table width="315" border="1"> <tr> <td>Email:</td> <td><input name='email' type='text' /></td> </tr> <tr> <td>Subject:</td> <td><input name='subject' type='text' value="Requested Quote" /></td> </tr> <tr> <td>First Name:</td> <td><input name='firstname' type='text' /></td> </tr> <tr> <td>Last Name:</td> <td><input name='lastname' type='text' /></td> </tr> <tr> <td>Company Name:</td> <td><input name='companyname' type='text' /></td> </tr> <tr> <td>Company Site:</td> <td><input name='companysite' type='text' /></td> </tr> <tr> <td>Address:</td> <td><input name='address' type='text' /></td> </tr> <tr> <td>Zip Code:</td> <td><input name='zipcode' type='text' /></td> </tr> <tr> <td>Product:</td> <td><input name='product' type='text' value="<?php echo $product?>" /></td> </tr> <tr> <td>Size:</td> <td><input name='size' type='text' /></td> </tr> <tr> <td>Quantity:</td> <td><input name='quantity' type='text' /></td> </tr> <tr> <td>Instructions:</td> <td><textarea name='message' rows='8' cols='40'> </textarea></td> </tr> </table> <input type='submit' /> </form>");?>[/code]that should work, ig2g. peaceHoTDaWg Link to comment https://forums.phpfreaks.com/topic/33225-need-some-help-with-php-script/#findComment-155114 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.