superkore Posted May 29, 2008 Share Posted May 29, 2008 I'm pretty new to php. I got a pretty simple mail form working to where it echos "thank you" or "error" when you hit submit, which is an image button. But of course it doesn't in any versions of ie. code is below is from my index.php page. Also I have a emailvalidater.php page below too. HELP! thanks <div class="box"> <div class="side_header"> <h1>CONTACT US</h1> </div><!-- /side_header --> <form action="<?php $SERVER['PHP_SELF']; ?>" method="post" name="contact_us" id="contact_us"> <p class="form"> <label for="name"></label> <input type="text" name="name" class="input_form" id="name" value="Your Name" onclick="select()" onfocus="this.value=''; this.onfocus=null;"/> </p> <p class="form"> <label for="email"></label> <input type="text" name="email" class="input_form" id="email" value="Your Email" onclick="select()" onfocus="this.value=''; this.onfocus=null;"/> </p> <p class="form"> <label for="phone"></label> <input type="text" name="phone" class="input_form" id="phonenum" value="Your Phone Number" onclick="select()" onfocus="this.value=''; this.onfocus=null;"/> </p> <p class="form"> <label for="comment"></label> <textarea name="comment" id="comment" cols="30" rows="15" class="text_box" onclick="select()" onfocus="this.value=''; this.onfocus=null;" >Type Message Here.</textarea> </p> <p class="submit_btn"> <input type="image" src="http://www.superkore.com/images/submit_btn.jpg" name="Submit" value="Submit" alt="submit btn"/> </p> </form> <div class="clear2"></div><!-- /clear2 --> <div class="echo_reply"> <p> <?php if(isset($_POST['Submit'])) { $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $comment = $_POST['comment']; $sendto = "[email protected]"; $subject = "A new comment has arrived via your site"; $body = 'A new comment has arrived via your website from: '.$name.' ('.$email.')\n Name: '.$name.'\n Email: '.$email.'\n phone: '.$phone.'\n Comment\n---------------------------------------\n'. $comment; include("emailvalidator.php"); if (check_email_address($email)) { mail($sendto, $subject, $body, "From:".$email); echo "Mail sent successfully!"; } else { echo "Invalid email address. Please try again."; } } ?> </p> </div><!-- /echo_reply --> ---------------------------emailvalidater.php code below------------ <?php function check_email_address($email) { if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { return false; } $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; } Link to comment https://forums.phpfreaks.com/topic/107895-solved-php-not-working-in-ie/ Share on other sites More sharing options...
Gighalen Posted May 29, 2008 Share Posted May 29, 2008 What charset are you using? Link to comment https://forums.phpfreaks.com/topic/107895-solved-php-not-working-in-ie/#findComment-553088 Share on other sites More sharing options...
superkore Posted May 29, 2008 Author Share Posted May 29, 2008 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <title>Superkore</title> <script type="text/javascript" src="js/swfobject.js"></script> <link rel="stylesheet" href="css/main.css" type="text/css" media="screen" /> <!--[if IE]> <link rel="stylesheet" type="text/css" href="css/all-ie.css" /> <![endif]--> <!--[if IE 6]> <link rel="stylesheet" type="text/css" href="css/ie-6.0.css" /> <![endif]--> <!--[if lt IE 5]> <link rel="stylesheet" type="text/css" href="css/ie-5.0+5.5.css" /> <![endif]--> </head> Link to comment https://forums.phpfreaks.com/topic/107895-solved-php-not-working-in-ie/#findComment-553094 Share on other sites More sharing options...
Gighalen Posted May 29, 2008 Share Posted May 29, 2008 Does it work when you just have a normal submit button? Try changing your charset to <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> Link to comment https://forums.phpfreaks.com/topic/107895-solved-php-not-working-in-ie/#findComment-553096 Share on other sites More sharing options...
AndyB Posted May 29, 2008 Share Posted May 29, 2008 Change if(isset($_POST['Submit'])) { to if(isset($_POST['Submit_x'])) { The way compliant browsers treat submit images is that they pass the x and y co-ordinates of where the image was clicked relative to its upper left corner - exactly how image maps are supposed to work. 'Submit' is never set, 'Submit_x' and 'Submit_y' will each be set. Link to comment https://forums.phpfreaks.com/topic/107895-solved-php-not-working-in-ie/#findComment-553100 Share on other sites More sharing options...
superkore Posted May 30, 2008 Author Share Posted May 30, 2008 got it working. thanks guy's for the help. Link to comment https://forums.phpfreaks.com/topic/107895-solved-php-not-working-in-ie/#findComment-553104 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.