Jump to content

[SOLVED] php not working in ie


superkore

Recommended Posts

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

<!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>

 

 

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.

Archived

This topic is now archived and is closed to further replies.

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