Jump to content

Form processing and sending email help


matt

Recommended Posts

Hello there,

I have created a contact us page to collect data. But I have problem to process the form and get it send to my email address, after many tries. :)
Because I need to get it done ASAP, so I really HOPE someone can help me out...
Please check out the link below, the contact us page is under "About Us".

Thanks a million,
matt

[a href=\"http://www.laubertecreatives.com\" target=\"_blank\"]My Webpage[/a]

[b]MOD EDIT(shoz): Topic modified[/b]
[quote]
DON'T Describe your question or problem as urgent, super important, must have by tommorrow etc...
[/quote]
Link to comment
Share on other sites

In order to help you it would help me and other to see the form or ever how you are generating the data that is to be processed as well as the processing page itself. There could be a simple answer but without seeing what you currently have it would not be possible to be of much more assistence.
Link to comment
Share on other sites

[!--quoteo(post=375547:date=May 20 2006, 07:16 PM:name=Houdini)--][div class=\'quotetop\']QUOTE(Houdini @ May 20 2006, 07:16 PM) [snapback]375547[/snapback][/div][div class=\'quotemain\'][!--quotec--]
In order to help you it would help me and other to see the form or ever how you are generating the data that is to be processed as well as the processing page itself. There could be a simple answer but without seeing what you currently have it would not be possible to be of much more assistence.
[/quote]



Hi,

Sorry, here is the code of the processing page:

<?php
$mail_to = "mattlau33@yahoo.com.sg";
$mail_subject="Online Inquery Form from Peakmore.com";
if ($name!="")
{
$mail_body .= "Message Sent From: ".$name."\n\n";
}
$mail_body .= $emailmessage;
if ($emailaddress!="")
{
if (mail($mail_to, $mail_subject, $mail_body, "From:$emailaddress"))
echo "Thank you.";
else
echo "Failed to send. Please try again.";
}
else
{
echo "You have not filled in your email address.";
}
?>
Link to comment
Share on other sites

OK after looking at the processing php there are a couple of question in order. Are register_globals turned on on your web server in PHP? What version of PHP is the server running (in case you don't know the firest).Could you also show the actual form and method?

There are logic flaws in your code that need correction for it to work properly. A quick and simple method would be to first determinne if...the user has entered an e-mail (isset() would work fine here) the user has actually pressed submit (give the submit button in the form a name and check if that [b]isset()[/b] before you do anything (prevent manipulation of the URL).

So it looks like a few samall logic changes as well as a method to validate the form with php are in order in this case. So with your indulgence then show your form, also I would suggest not putting your real e-mail in the post as it is not important to me but might be to others that could abuse it. Put a bogus or use [at] instead of [b]@[/b] since a spambot or other bot will attempt to use it.
Link to comment
Share on other sites

[!--quoteo(post=375556:date=May 20 2006, 08:00 PM:name=Houdini)--][div class=\'quotetop\']QUOTE(Houdini @ May 20 2006, 08:00 PM) [snapback]375556[/snapback][/div][div class=\'quotemain\'][!--quotec--]
OK after looking at the processing php there are a couple of question in order. Are register_globals turned on on your web server in PHP? What version of PHP is the server running (in case you don't know the firest).Could you also show the actual form and method?

There are logic flaws in your code that need correction for it to work properly. A quick and simple method would be to first determinne if...the user has entered an e-mail (isset() would work fine here) the user has actually pressed submit (give the submit button in the form a name and check if that [b]isset()[/b] before you do anything (prevent manipulation of the URL).

So it looks like a few samall logic changes as well as a method to validate the form with php are in order in this case. So with your indulgence then show your form, also I would suggest not putting your real e-mail in the post as it is not important to me but might be to others that could abuse it. Put a bogus or use [at] instead of [b]@[/b] since a spambot or other bot will attempt to use it.
[/quote]


Hi,
I am not sure whether the register_globals has turned on or not? (I didn't know about this in the first place as I am very knew to php :) Not sure the PHP version of the server either, but can be checked. I will attach the code of the actual form below.
Thanks for your advice of not putting the real e-mail address, appreciated that.
Anyhow, I am going offline now as it is late nite 4:15am here, and I really pooped :) I certainly HOPE you will help me on this and if you do not mind, will appreciate you would correspond via email, Thanks! matt

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Contact Us</title>
<style type="text/css">
<!--
body {
background-color: #FFFFFF;
}
.headline1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 16px;
font-style: normal;
line-height: normal;
font-weight: bold;
font-variant: normal;
color: #246892;
}
.headline2 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-style: normal;
line-height: normal;
font-weight: bold;
font-variant: normal;
color: #246892;
}
.headline3 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: bold;
font-variant: normal;
color: #246892;
}
.bodytext {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
color: #333333;
}
.footertext {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 9px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
color: #000000;
}
.linkhierarchy {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: uppercase;
color: #999900;
}
.linkhierarchy1 { font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: uppercase;
color: #999900;
}
a:link {
color: #999900;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #999999;
}
a:hover {
text-decoration: underline;
color: #CCCC99;
}
a:active {
text-decoration: none;
}
.livery {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 24px;
font-style: normal;
line-height: normal;
font-weight: bold;
font-variant: normal;
color: #76B9CA;
}
-->
</style></head>

<body>
<table width="810" border="0">
<tr>
<th height="40" scope="row"><table width="810" height="66" border="0">
<tr>
<th scope="col"><img src="images/HomePageTopBar.jpg" width="799" height="70"></th>
</tr>
</table></th>
</tr>
</table>
<table width="814" height="600" border="0">
<!--DWLayoutTable-->
<tr>
<td height="50" colspan="2" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
<tr>
<td height="267" valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="150" height="250">
<param name="movie" value="images/PeakmoreMenu.swf">
<param name="quality" value="high">
<embed src="images/PeakmoreMenu.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="150" height="250"></embed>
</object></td>
<td width="621" rowspan="2" valign="top"><p class="linkhierarchy1">About us &gt; <a href="profile.htm">Profile</a> / Contact us</p>
<form action="contactus_action.php" method="post" name="inquery_form" class="bodytext" id="inquery_form">
<p>Your inquery and feedback is important to us. Please fill in the fields below:</p>
<table width="550" border="0" cellspacing="10" cellpadding="0">
<!--DWLayoutTable-->
<tr>
<td width="142" class="bodytext"><div align="right">* Name:</div></td>
<td width="378"><input name="textfield" type="text" class="bodytext" size="30" maxlength="40"></td>
</tr>
<tr>
<td class="bodytext"><div align="right">* Company:</div></td>
<td><input name="textfield" type="text" class="bodytext" size="40" maxlength="50"></td>
</tr>
<tr>
<td><div align="right">Address:</div></td>
<td><input name="textfield" type="text" class="bodytext" size="60" maxlength="100"></td>
</tr>
<tr>
<td><div align="right">City:</div></td>
<td><input name="textfield" type="text" class="bodytext" size="30" maxlength="30"></td>
</tr>
<tr>
<td><div align="right">* Country:</div></td>
<td><select name="Select a country" size="1" class="bodytext" id="Select a country">
<option value="Select a country" selected>Select a country</option>
<option value="Abkhazia">Abkhazia</option>
<option value="Afghanistan">Afghanistan</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>
<option value="Anguilla">Anguilla</option>
<option value="Antigua and Barbuda">Antigua and Barbuda</option>
<option value="Argentina">Argentina</option>
<option value="Armenia">Armenia</option>
<option value="Aruba">Aruba</option>
<option value="Australia">Australia</option>
<option value="Austria">Austria</option>
<option value="Azerbaijan">Azerbaijan</option>
<option value="Bahamas">Bahamas</option>
<option value="Bahrain">Bahrain</option>
<option value="Bangladesh">Bangladesh</option>
<option value="Barbados">Barbados</option>
<option value="Belarus">Belarus</option>
<option value="Belgium">Belgium</option>
<option value="Belize">Belize</option>
<option value="Benin">Benin</option>
<option value="Bermuda">Bermuda</option>
<option value="Bhutan">Bhutan</option>
<option value="Bolivia">Bolivia</option>
<option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option>
<option value="Botswana">Botswana</option>
<option value="Brazil">Brazil</option>
<option value="British Virgin Islands">British Virgin Islands</option>
<option value="Brunei">Brunei</option>
<option value="Bulgaria">Bulgaria</option>
<option value="Burkina Faso">Burkina Faso</option>
<option value="Burundi">Burundi</option>
<option value="Cambodia">Cambodia</option>
<option value="Cameroon">Cameroon</option>
<option value="Canada">Canada</option>
<option value="Cape Verde">Cape Verde</option>
<option value="Cayman Islands">Cayman Islands</option>
<option value="Central African Republic">Central African Republic</option>
<option value="Chad">Chad</option>
<option value="Chile">Chile</option>
<option value="Christmas Island">Christmas Island</option>
<option value="Cocos Island">Cocos Island</option>
<option value="Colombia">Colombia</option>
<option value="Comoros">Comoros</option>
<option value="Cook Islands">Cook Islands</option>
<option value="Costa Rica">Costa Rica</option>
<option value="Croatia">Croatia</option>
<option value="Cuba">Cuba</option>
<option value="Cyprus">Cyprus</option>
<option value="Czech Republic">Czech Republic</option>
<option value="Cote d'Ivoire">Cote d'Ivoire</option>
<option value="Democratic Republic of the Congo">Democratic Republic of the Congo</option>
<option value="Denmark">Denmark</option>
<option value="Djibouti">Djibouti</option>
<option value="Dominica">Dominica</option>
<option value="Dominican Republic">Dominican Republic</option>
<option value="East Timor">East Timor</option>
<option value="Ecuador">Ecuador</option>
<option value="Egypt">Egypt</option>
<option value="El Salvador">El Salvador</option>
<option value="Equatorial Guinea">Equatorial Guinea</option>
<option value="Eritrea">Eritrea</option>
<option value="Estonia">Estonia</option>
<option value="Ethiopia">Ethiopia</option>
<option value="Falkland Islands">Falkland Islands</option>
<option value="Faroe Islands">Faroe Islands</option>
<option value="Fiji">Fiji</option>
<option value="Finland">Finland</option>
<option value="France">France</option>
<option value="French Poly">French Poly</option>
<option value="Gabon">Gabon</option>
<option value="Gambia">Gambia</option>
<option value="Georgia">Georgia</option>
<option value="Germany">Germany</option>
<option value="Ghana">Ghana</option>
<option value="Gibraltar">Gibraltar</option>
<option value="Greece">Greece</option>
<option value="Greenland">Greenland</option>
<option value="Grenada">Grenada</option>
<option value="Guam">Guam</option>
<option value="Guatemala">Guatemala</option>
<option value="Guernsey">Guernsey</option>
<option value="Guinea">Guinea</option>
<option value="Guinea-Bissau">Guinea-Bissau</option>
<option value="Guyana">Guyana</option>
<option value="Haiti">Haiti</option>
<option value="Honduras">Honduras</option>
<option value="Hong Kong">Hong Kong</option>
<option value="Hungary">Hungary</option>
<option value="Iceland">Iceland</option>
<option value="India">India</option>
<option value="Indonesia">Indonesia</option>
<option value="Iran">Iran</option>
<option value="Iraq">Iraq</option>
<option value="Ireland">Ireland</option>
<option value="Isle of Man">Isle of Man</option>
<option value="Israel">Israel</option>
<option value="Italy">Italy</option>
<option value="Jamaica">Jamaica</option>
<option value="Japan">Japan</option>
<option value="Jersey">Jersey</option>
<option value="Jordan">Jordan</option>
<option value="Kazakhstan">Kazakhstan</option>
<option value="Kenya">Kenya</option>
<option value="Kiribati">Kiribati</option>
<option value="Kosovo">Kosovo</option>
<option value="Kuwait">Kuwait</option>
<option value="Kyrgyzstan">Kyrgyzstan</option>
<option value="Laos">Laos</option>
<option value="Latvia">Latvia</option>
<option value="Lebanon">Lebanon</option>
<option value="Lesotho">Lesotho</option>
<option value="Liberia">Liberia</option>
<option value="Libya">Libya</option>
<option value="Liechtenstein">Liechtenstein</option>
<option value="Lithuania">Lithuania</option>
<option value="Luxembourg">Luxembourg</option>
<option value="Macau">Macau</option>
<option value="Macedonia">Macedonia</option>
<option value="Madagascar">Madagascar</option>
<option value="Malawi">Malawi</option>
<option value="Malaysia">Malaysia</option>
<option value="Maldives">Maldives</option>
<option value="Mali">Mali</option>
<option value="Malta">Malta</option>
<option value="Marshall Islands">Marshall Islands</option>
<option value="Mauritania">Mauritania</option>
<option value="Mauritius">Mauritius</option>
<option value="Mayotte2">Mayotte2</option>
<option value="Mexico">Mexico</option>
<option value="Micronesia">Micronesia</option>
<option value="Moldova">Moldova</option>
<option value="Monaco">Monaco</option>
<option value="Mongolia">Mongolia</option>
<option value="Montserrat">Montserrat</option>
<option value="Morocco">Morocco</option>
<option value="Mozambique">Mozambique</option>
<option value="Myanmar">Myanmar</option>
<option value="Nagorno-Karabakh">Nagorno-Karabakh</option>
<option value="Namibia">Namibia</option>
<option value="Nauru">Nauru</option>
<option value="Nepal">Nepal</option>
<option value="Netherlands">Netherlands</option>
<option value="Netherlands Antilles">Netherlands Antilles</option>
<option value="New Caledonia">New Caledonia</option>
<option value="New Zealand">New Zealand</option>
<option value="Nicaragua">Nicaragua</option>
<option value="Niger">Niger</option>
<option value="Nigeria">Nigeria</option>
<option value="Niue">Niue</option>
<option value="Norfolk Island">Norfolk Island</option>
<option value="North Korea">North Korea</option>
<option value="Northern Cyprus">Northern Cyprus</option>
<option value="Northern Mariana Islands">Northern Mariana Islands</option>
<option value="Norway">Norway</option>
<option value="Oman">Oman</option>
<option value="Pakistan">Pakistan</option>
<option value="Palau">Palau</option>
<option value="Palestine">Palestine</option>
<option value="Panama">Panama</option>
<option value="Papua New Guinea">Papua New Guinea</option>
<option value="Paraguay">Paraguay</option>
<option value="People's Republic of China">People's Republic of China</option>
<option value="Peru">Peru</option>
<option value="Philippines">Philippines</option>
<option value="Pitcairn Islands">Pitcairn Islands</option>
<option value="Poland">Poland</option>
<option value="Portugal">Portugal</option>
<option value="Puerto Rico">Puerto Rico</option>
<option value="Qatar">Qatar</option>
<option value="Republic of Macedonia">Republic of Macedonia</option>
<option value="Republic of the Congo">Republic of the Congo</option>
<option value="Romania">Romania</option>
<option value="Russia">Russia</option>
<option value="Rwanda">Rwanda</option>
<option value="SPM">SPM</option>
<option value="Saint Helena">Saint Helena</option>
<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
<option value="Saint Lucia">Saint Lucia</option>
<option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option>
<option value="Samoa">Samoa</option>
<option value="San Marino">San Marino</option>
<option value="Saudi Arabia">Saudi Arabia</option>
<option value="Senegal">Senegal</option>
<option value="Serbia and montenegro">Serbia and Montenegro</option>
<option value="Seychelles">Seychelles</option>
<option value="Sierra Leone">Sierra Leone</option>
<option value="Singapore">Singapore</option>
<option value="Slovakia">Slovakia</option>
<option value="Slovenia">Slovenia</option>
<option value="Solomon Islands">Solomon Islands</option>
<option value="Somalia">Somalia</option>
<option value="Somaliland">Somaliland</option>
<option value="South Africa">South Africa</option>
<option value="South Korea">South Korea</option>
<option value="South Ossetia">South Ossetia</option>
<option value="Spain">Spain</option>
<option value="Sri Lanka">Sri Lanka</option>
<option value="Sudan">Sudan</option>
<option value="Suriname">Suriname</option>
<option value="Swaziland">Swaziland</option>
<option value="Sweden">Sweden</option>
<option value="Switzerland">Switzerland</option>
<option value="Syria">Syria</option>
<option value="Sao Tome and Principe">Sao Tome and Principe</option>
<option value="Taiwan">Taiwan</option>
<option value="Tajikistan">Tajikistan</option>
<option value="Tanzania">Tanzania</option>
<option value="Thailand">Thailand</option>
<option value="Togo">Togo</option>
<option value="Tokelau">Tokelau</option>
<option value="Tonga">Tonga</option>
<option value="Transnistria">Transnistria</option>
<option value="Trinidad Tobago">Trinidad and Tobago</option>
<option value="Tristan da Cunha">Tristan da Cunha</option>
<option value="Tunisia">Tunisia</option>
<option value="Turkey">Turkey</option>
<option value="Turkmenistan">Turkmenistan</option>
<option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
<option value="Tuvalu">Tuvalu</option>
<option value="U.S. Virgin Islands">U.S. Virgin Islands</option>
<option value="Uganda">Uganda</option>
<option value="Ukraine">Ukraine</option>
<option value="United Arab Emirates">United Arab Emirates</option>
<option value="United Kingdom">United Kingdom</option>
<option value="United States">United States</option>
<option value="Uruguay">Uruguay</option>
<option value="Uzbekistan">Uzbekistan</option>
<option value="Vanuatu">Vanuatu</option>
<option value="Vatican City">Vatican City</option>
<option value="Venezuela">Venezuela</option>
<option value="Vietnam">Vietnam</option>
<option value="W and F">W and F</option>
<option value="Western Sahara">Western Sahara</option>
<option value="Yemen">Yemen</option>
<option value="Zambia">Zambia</option>
<option value="Zimbabwe">Zimbabwe</option>
</select></td>
</tr>
<tr>
<td><div align="right">* Telephone:</div></td>
<td><input name="textfield" type="text" class="bodytext" size="30" maxlength="30"></td>
</tr>
<tr>
<td><div align="right">* E-mail:</div></td>
<td><input name="textfield" type="text" class="bodytext" size="40" maxlength="40"></td>
</tr>
<tr>
<td height="3"></td>
<td rowspan="3"><p>
<textarea name="textfield" cols="60" rows="10" class="bodytext"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
<p>&nbsp;</p>
<p>* indicates mandatory field </p></td>
</tr>
<tr>
<td height="182" valign="top"><div align="right">Inquery:</div></td>
</tr>
<tr>
<td height="3"></td>
</tr>
<tr>
<td height="34">&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
</form> <p class="linkhierarchy1">&nbsp;</p></td>
</tr>
<tr>
<td width="183" height="289">&nbsp;</td>
</tr>
<tr>
<td height="23">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr align="center">
<td height="162" colspan="2" valign="top"><img src="images/HomePageBottomBar.jpg" width="799" height="160"></td>
</tr>
<tr>
<td height="9"></td>
<td></td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>
Link to comment
Share on other sites

OK this is not tested but try it out so far you have no results and this will at least give you and others something to work with
[code]<?php
if(isset($_POST[email])){
$name=$_POST['name'];
$mail_to = "mattlau33@yahoo.com.sg";
$mail_subject="Online Inquery Form from Peakmore.com";
$mail_body = "Message Sent From: ".$name."\r\n<br />";
$mail_body .= wordwrap({$_POST['emailmessage']},72,"<br />\r\n");
    if (mail($mail_to, $mail_subject, $mail_body, "From:$emailaddress")){
        echo "Thank you.";
    }
    else
    {
        echo "Failed to send. Please try again.";
    }
}
else
{
echo "You have not filled in your email address.";
}
?>[/code]Also when posting code to forums select the code with your mouse and click the BB code for code or place [ code ] code in here and [ /code ] minus the spaces to present your code as I have it is much easier to read.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.