Jump to content

Recommended Posts

[code]got a contact form on a new site which features form validation(but this is JS) and then confirmation of successful submission which works fine in Firefox but doesn't do a thing in IE

I've gone over my html and can't see anything which would stop it working for IE so I'm wondering if theres something to the php I've written which might be messy and causing issues

this snippet is inserted prior to the head tags of the page

[code]
<?php
$name = strip_tags($_POST['enq_name'],''); 
$mail = strip_tags($_POST['enq_mail'],'');
$addy = strip_tags($_POST['enq_address'],'');
$postcode = strip_tags($_POST['enq_postcode'],'');
$tel = strip_tags($_POST['enq_tel'],'');
$company = strip_tags($_POST['enq_company'],'');
$subject = $_POST['enq_subject'];

if($_POST['enq_submit'] && $_POST['enq_name'] && $_POST['enq_mail'] && $_POST['enq_postcode']  && $_POST['enq_tel']) {

$headers = 'From: Bestford and Company Web User' . "\r\n" .
  'Reply-To: DO NOT REPLY TO THIS MESSAGE' . "\r\n" .
  'X-Mailer: PHP/' . phpversion();

$content = "
$name has just completed the online enquiry form and would like more information on $subject

Please contact $name shortly, the contact details are as follows:

Company Name: $company
----------------------
Address: $addy
----------------------
Postcode: $postcode
----------------------
Tel: $tel
----------------------
Email: $mail

";

mail("[email protected]","Bestford and Company Online Enquiry",$content, $headers);

}
?>[/code]

then theres the confirmation which is done as follows

[code]<form action="<?php echo $PHP_SELF; ?>" method="POST" name="bestford_enq">
<table class="enq" cellspacing="0" cellpadding="2">
<tr class="enq"><td class="label">Name*</td><td class="form"><input name="enq_name" value="<?php echo $name; ?>" type="text" maxlength="100"/></td></tr>
<tr class="enq" ><td class="label" style="border-top: solid 1px #d0d0d0">Email*</td><td class="form"><input name="enq_mail" value="<?php echo $mail; ?>" type="text" maxlength="100"/></td></tr>
<tr class="enq"><td class="label" style="border-top: solid 1px #d0d0d0">Address*</td><td class="form"><textarea name="enq_address" rows="5" cols="10"><?php echo $addy; ?></textarea></td></tr>
<tr class="enq"><td class="label" style="border-top: solid 1px #d0d0d0">Postcode*</td><td class="form"><input name="enq_postcode" value="<?php echo $postcode; ?>" type="text" maxlength="10"/></td></tr>
<tr class="enq"><td class="label" style="border-top: solid 1px #d0d0d0">Tel*</td><td class="form"><input name="enq_tel" value="<?php echo $tel; ?>" type="text" maxlength="20"/></td></tr>
<tr class="enq"><td class="label" style="border-top: solid 1px #d0d0d0">Company Name</td><td class="form"><input name="enq_company" value="<?php echo $company; ?>" type="text" maxlength="60"/></td></tr>
<tr class="enq"><td class="label" style="border-top: solid 1px #d0d0d0">Regarding*</td><td class="form"><select name="enq_subject" size="1">
<option selected value="0">Please select one</option>
<option value="0">-------------------------</option>
<option>Commercial Insurance</option>
<option>Taxi Insurance</option>
<option>Personal Insurance</option>
<option>Travel Insurance</option>
</select></td></tr>
<tr class="enq"><td colspan="2" style="border-top: solid 1px #b5b5b5;"><input type="image" name="enq_submit" value="submit" src="img/submit.gif" class="submit" /><p style="width:150px;margin:8px 0;display:inline;float:right; line-height:10px;"><?php if($_POST['enq_submit']){ if($_POST['enq_submit'] && $_POST['enq_name'] && $_POST['enq_mail'] && $_POST['enq_postcode']  && $_POST['enq_tel']){ echo "<span style=\"color:green;\">Thankyou for your enquiry</span>";}else{ echo "<span style=\"color:red;\">** Complete fields for a successful submission</span>";}} else { echo "* Complete fields for a successful submission";} ?></p></td></tr>
</table></form>
[/code]

When i've completed all of the required fields the JS allows the post, however, the "Thankyou for your enquiry" message does not appear, it remains as "* Complete fields for a successful submission" and I don't receive the e-mail message

Can anyone see anything in my PHP which would cause the problem ??[/code]
Where's the javascript? IE is very picky about spacing, commas, lots of things in JS. Post the javascript in the javascript forum, as it's probably a problem in there. Also, make sure to turn javascript error reporting on in your IE so you can see the error.
i'll just let you no that your PHP looks fine to me... but next time you post i suggest you wrap your code in [ code ] [/ code] tags, minus the spaces of course.

just with this:
[code=php:0]
$name = strip_tags($_POST['enq_name'],'');
$mail = strip_tags($_POST['enq_mail'],'');
$addy = strip_tags($_POST['enq_address'],'');
$postcode = strip_tags($_POST['enq_postcode'],'');
$tel = strip_tags($_POST['enq_tel'],'');
$company = strip_tags($_POST['enq_company'],'');
[/code]

the second parameter, the one that specifices which tags are allowed, you dont have to have anything there.. because its optional. :)
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.