...

View Full Version : Html form



designer525
07-23-2010, 03:40 PM
I have an HTML form that has validations on some fields as well as other fields that dont have it. The past couple of days I have been getting blank emails of every form at least once a day. I have a few forms in my website, including ones in different languages, and this morning i got an email from each form with blank answers. I have a captcha on each one of the forms too. HELP

VIPStephan
07-23-2010, 03:52 PM
Would you go to the police to report that your car was stolen without telling them what kind of car, how it looked, and where it was stolen? No? So why do you think you get help here without giving any useful information?

designer525
07-23-2010, 04:01 PM
sorry, no need to be rude. I wasnt sure what you guys would need. Cause its an html form that is run with php.
<form name="form1" action="captcha.php","http://www.mark-10.com/cgi-bin/mailto" method="post" onsubmit="return ErrorCheck();">
<INPUT TYPE="hidden" NAME="RECIPIENT" VALUE="info@mark-10.com">
<INPUT TYPE="hidden" NAME="subject" VALUE="Mark-10 Web Submit Form">
<INPUT TYPE="hidden" NAME="THANKURL" VALUE="http://www.mark-10.com/thankyou-inquiry.html">
<input type="hidden" name="identicalfields" value="email,email2">

<table width="661" height="254" border="0" align="center" cellpadding="3" cellspacing="0">
<tr valign="middle" class="style1">
<td><div align="right"><font color="#000000"><span class="largeBlackBody"><span class="LargeBold12Cs-b">*Name:</span></span></font></div></td>
<td><input name="name" type="text" id="name" size="20">
&nbsp;&nbsp;</td>
</tr>
<tr class="boduHelv12">
<td><div align="right">Title:</div></td>
<td><span class="LargeBold12Cs-b">
<input name="surname" type="text" id="surname" size="20">
</span></td>
</tr>
<tr class="style1">
<td valign="middle"><div align="right" class="LargeBold12Cs-b"><font color="#000000" class="largeBlackBody">*Email:</font></div></td>
<td><input name="email" type="text" id="email" size="38"></td>
</tr>
<tr class="style1">
<td valign="middle"><div align="right" class="LargeBold12Cs-b"><font color="#000000" class="largeBlackBody">*Confirm Email:</font></div></td>
<td><input name="email2" type="text" id="email2" size="38"></td>
</tr>
<tr class="style1">
<td width="108" valign="middle"><div align="right"><font color="#000000" class="LargeBold12Cs-b">Company:</font></div></td>
<td width="541"><input name="Company" type="text" id="Company" size="45">
&nbsp;<br></td>
</tr>
<tr valign="middle" class="style1">
<td width="108"><div align="right" class="LargeBold12Cs-b"><font color="#000000" class="largeBlackBody">*Address:</font></div></td>
<td width="541"><input name="address" type="text" id="address" size="40">
</td>
</tr>
<tr valign="middle" class="style1">
<td width="108"><div align="right" class="LargeBold12Cs-b">*City:</div></td>
<td width="541"><input name="city" type="text" id="city" size="20">
<font color="#000000" class="largeBlackBody">&nbsp;</font></td>
</tr>
<tr valign="middle" class="style1">
<td><div align="right" class="LargeBold12Cs-b">*State:</div></td>
<td><input name="region" type="text" id="region" size="10"></td>
</tr>
<tr valign="middle" class="style1">
<td><div align="right" class="LargeBold12Cs-b"><font color="#000000" class="largeBlackBody">*ZIP/Postal Code:</font></div></td>
<td><input name="zip" type="text" id="zip" size="8"></td>
</tr>
<tr valign="middle" class="style1">
<td><div align="right" class="LargeBold12Cs-b"><font color="#000000" class="largeBlackBody">*Country:</font></div></td>
<td><input name="country" type="text" id="country" size="8"></td>
</tr>
<tr valign="middle" class="style1">
<td width="108"><div align="right"><font color="#000000" class="LargeBold12Cs-b">Telephone:</font></div></td>
<td width="541"><input name="telephone" type="text" id="telephone" size="25">
&nbsp;&nbsp;<font color="#000000" class="LargeBold12Cs-b">Ext:</font>
<input name="extension" type="text" id="extension" size="25"></td>
</tr>
<tr valign="middle" class="style1">
<td><div align="right"><font color="#000000" class="LargeBold12Cs-b">Fax:</font></div></td>
<td><input name="fax" type="text" id="mobile" size="25"></td>
</tr>
<tr valign="middle" class="style1">
<td><div align="right"><font color="#000000" class="LargeBold12Cs-b"> Application or Question:</font></div></td>
<td><p><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b>
<textarea name="comments" cols="60" rows="5" wrap="PHYSICAL" id="comments"></textarea>
</b></font></p>


</td>
</tr>
<tr bordercolor="#111111">
<td colspan="2" height="6"><input type="checkbox" name="SendCatalog" value="Yes">
<font size="2"> Send me
your latest catalog</font></td>
</tr>
<tr bordercolor="#111111">
<td colspan="2" height="34"><input type="checkbox" name="AddToMailingList" value="Yes">
<font size="2"> Add me to
your mailing list</font></td>
</tr>
<tr valign="middle" class="style1">
<td>&nbsp;</td>
<td align="left" valign="top">*Please Enter Code-&gt;<img src="captcha_image.php" alt="" />: </div>
<input name="Security_Code" type="text" id="Security_Code" size="15"></td>
</tr>
</table>
<table width="663" class="bigone">
<tr class="style1">
<td width="109" height="38" align="center"><p>
<td width="542" align="left"><input name="Submit" type="submit" id="scratch_submit" onClick="MM_validateForm('email','','RisEmail','email2','','RisEmail','address','','R','city','','R','region' ,'','R','zip','','R','country','','R','Security_Code','','R');return document.MM_returnValue" value="Submit">
<input type="reset" name="Reset" value="Reset">
*Required Fields
</tr>
</table>

</form></td>
</tr>
</table>
<br>





<table cellspacing="2" width=525 border=0 celpadding="3">



</table>
</FORM>

designer525
07-23-2010, 04:01 PM
<?


session_start();


if ($_POST['Security_Code'] == $_SESSION["pass"])
{
header("Location: http://www.mark-10.com/thankyou-inquiry.html");


//sends email via php to the following address
$mailuser = "info@mark-10.com";

//echo 'default chosen address: '.$mailuser;

$header = "Return-Path: ".$mailuser."\r\n";
$header .= "From: Inquiry<".$mailuser.">\r\n";
$header .= "Content-Type: text/html;";

$mail_body =
'The User: '.$_POST[name].' has sent his input.
Name: '. $_POST[name] . '<br>
Title: '. $_POST[surname] . '<br>
email: '. $_POST[email] . '<br>
confirm email: '. $_POST[email2] . '<br>
Company: '. $_POST[company] . '<br>
Address: '. $_POST[address] . '<br>
Address: '. $_POST[address2] . '<br>
City: '. $_POST[city] . '<br>
State: '. $_POST[region] . '<br>
Zip: '. $_POST[zip] . '<br>
Country: '. $_POST[country] . '<br>
Telephone: '. $_POST[tel] . '<br>
Extention: '. $_POST[ext] . '<br>
fax: '. $_POST[fax] . '<br>
Application or Question:' . $_POST[comments] .'<br>
Catalog:' . $_POST[SendCatalog] .'<br>
Mailing List:' . $_POST[AddToMailingList] .'<br>'
;
mail ($mailuser, 'Mark-10 Web Inquiry', $mail_body, $header);
echo 'THANKS ';


} else {
header( "Location:http://www.mark-10.com/tryagain.html" ) ;
exit;
}
?>

tomws
07-23-2010, 04:47 PM
There's no data validation in the form handler (assuming the PHP you posted is captcha.php, that's your form handler). Unless that javascript function ErrorCheck() that the form uses onsubmit contains it, it's entirely possible to get empty values or anything else. Since you didn't post that function, it's impossible to know what it does.

Apostropartheid
07-23-2010, 06:20 PM
Make a start by printing out your POST variables; that way we can see whether, as Tom said, the variables ever reach the script.

designer525
07-23-2010, 07:02 PM
yes it is. Its on the submit button, when they hit the submit button and the fields aren't filled out a window pops up that they need to fill in those fields. here is the error check js its only for the email to make sure that there fields match.

function ErrorCheck() {
var formname = "form1";
var fieldwithlist = "identicalfields";
var er = new String();
var tempstring = eval("document."+formname+"."+fieldwithlist+".value");

if(tempstring.length > 1) {
var idi = tempstring.split(',');
var ts0 = eval("document."+formname+"."+idi[0]+".value");
var ts1 = eval("document."+formname+"."+idi[1]+".value");
if(ts0 != ts1) { er = 'The e-mail addresses do not match. Please re-enter them again.'; }
}

if(er.length > 0) {
alert(er);
return false;
}

return true;
}

tomws
07-23-2010, 07:44 PM
Oh, I see. The required field checker is one of those crappy Dreamweaver functions. Got it. Assuming that actually works, your next step would be to follow Apostropartheid's advice and dump your post variables at the top of the form handler. I'd recommend doing the same for the session variables, too.

designer525
07-23-2010, 07:51 PM
what will dumping those variables on top do?

tomws
07-23-2010, 07:57 PM
what will dumping those variables on top do?
This:

Make a start by printing out your POST variables; that way we can see whether, as Tom said, the variables ever reach the script.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum