...

View Full Version : PHP email form help



bahamabaker
03-23-2010, 04:34 PM
Making a service request form for a website. the resulting email shows
Email: fdgdfgdfg@gmail.com
First Name:
Last Name:
Phone Number:
Cell Phone Number:
Address:
New System Quote:
Service Call:
Product Info:
Other:
but not the other form items.
PHP form is this:
<?php

/* Incoming Subject and Email Variables - Fixed */

$emailSubject = 'Service Request Form';
$webMaster = 'email@email.com, email@email.com';

/* Gathering Data Variables - User Data */

$first = $_POST['first'];
$last = $_POST['last'];
$phone = $_POST['phone'];
$cell = $_POST['cell'];
$address = $_POST['address'];
$new = $_POST['new'];
$service = $_POST['service'];
$product = $_POST['product'];
$other = $_POST['other'];
$comments = $_POST['comments'];

$email = $_POST['email'];


$body = <<<EOD
<br><hr><br>
Email: $email <br>
First Name: $first <br>
Last Name: $last <br>
Phone Number: $phone <br>
Cell Phone Number: $cell <br>
Address: $address <br>

New System Quote: $new <br>
Service Call: $service <br>
Product Info: $product <br>
Other: $other <br>
<hr/>
Comments: $comments <br>
EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);

/* Results rendered as code */

$theResults = <<<EOD
<html>
<head>
<title>Thanks</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #ff0000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 18px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #ooooo;
text-decoration: none;
}
-->
</style>
</head>
<body>
<div>
<div align="left">Thank you! Your service request will be answered very soon!</div>
</div>
<a href="http://www.secureittrinidad.com"> Click Here to go back to Secure It's Home Page <a/>


</body>
</html>
EOD;
echo $theResults;
?>


Form HTML is this:

<form id="form_209708" class="appnitro" method="post" action="http://secureittrinidad.com/form.php">
<input type="hidden" name="required" value="email:Your email address" />
<div class="form_description">
<h2 class="style7">Service Request Form</h2>
<p class="style7">Contact Secure It for help on your existing system or installing a new system.</p>
</div>
<ul >
<li id="li_1" >
<label class="description" for="element_1">Name </label>
<span>
<input id="first" name= "first" class="element text" maxlength="255" size="8" value=""/>
<label>First</label>
</span> <span>
<input id="last" name= "last" class="element text" maxlength="255" size="14" value=""/>
<label>Last</label>
</span> </li>
<li id="li_2" >
<label class="description" for="element_2">Phone </label>
<div>
<input id="phone" name="phone" class="element text medium" type="text" maxlength="255" value=""/>
</div>
</li>
<li id="li_6" >
<label class="description" for="element_6">Cell Phone </label>
<div>
<input id="cell" name="cell" class="element text medium" type="text" maxlength="255" value=""/>
</div>
</li>
<li id="li_3" >
<label class="description" for="element_3">Email </label>
<div>
<input id="email" name="email" class="element text medium" type="text" maxlength="255" value=""/>
</div>
</li>
<li id="li_4" >
<label class="description" for="element_4">Address </label>
<div>
<textarea id="address" name="address" class="element textarea small"></textarea>
</div>
</li>
<li class="section_break">
<h3 class="style8">Service Requested</h3>
<p></p>
</li>
<li id="li_9" >
<label class="description" for="element_9"></label>
<span>
<input id="new" name="new" class="element radio" type="radio" value="1" />
<label class="choice" for="element_9_1">New System Quote</label>
<input id="service" name="service" class="element radio" type="radio" value="2" />
<label class="choice" for="element_9_2">Repair/Service on your system</label>
<input id="product" name="product" class="element radio" type="radio" value="3" />
<label class="choice" for="element_9_3">Info about our products</label>
<input id="other" name="other" class="element radio" type="radio" value="4" />
<label class="choice" for="element_9_4">Other</label>
</span> </li>
<li id="li_7" >
<label class="description" for="element_7">Comments </label>
<div>
<textarea id="comments" name="comments" class="element textarea medium"></textarea>
</div>
</li>
<li class="section_break">
<h3></h3>
<p></p>
</li>
<li class="buttons">
<input type="hidden" name="form_id" value="209708" />
<input id="saveForm" class="button_text" type="submit" name="submit" value="Send Request" style="background-color:#ff0000;color:#000000;" />
</li>
</ul>
</form>


Thanks

abduraooft
03-23-2010, 04:39 PM
PHP form is this:
<?php

/* Incoming Subject and Email Variables - Fixed */
Try

if(isset($_POST['submit'])){
/* Incoming Subject and Email Variables - Fixed */

$emailSubject = 'Service Request Form';
$webMaster = 'email@email.com, email@email.com';

/* Gathering Data Variables - User Data */

$first = $_POST['first'];
$last = $_POST['last'];
$phone = $_POST['phone'];
$cell = $_POST['cell'];
$address = $_POST['address'];
$new = $_POST['new'];
$service = $_POST['service'];
$product = $_POST['product'];
$other = $_POST['other'];
$comments = $_POST['comments'];

$email = $_POST['email'];


$body = <<<EOD
<br><hr><br>
Email: $email <br>
First Name: $first <br>
Last Name: $last <br>
Phone Number: $phone <br>
Cell Phone Number: $cell <br>
Address: $address <br>

New System Quote: $new <br>
Service Call: $service <br>
Product Info: $product <br>
Other: $other <br>
<hr/>
Comments: $comments <br>
EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);

/* Results rendered as code */

$theResults = <<<EOD
<html>
<head>
<title>Thanks</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #ff0000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 18px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #ooooo;
text-decoration: none;
}
-->
</style>
</head>
<body>
<div>
<div align="left">Thank you! Your service request will be answered very soon!</div>
</div>
<a href="http://www.secureittrinidad.com"> Click Here to go back to Secure It's Home Page <a/>


</body>
</html>
EOD;
echo $theResults;
}

bahamabaker
03-23-2010, 05:46 PM
Tried that, no luck

bahamabaker
03-23-2010, 06:25 PM
fixed it...thanks

cyclerider
04-23-2010, 07:33 PM
In such case I suggest to use form builder (http://*************/tutorial/html-basics/form-builder.html). There is no need in monotonous copy-pasting. It creates all types of forms.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum