CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 3 of 3

Thread: Works in IE, not in FF

  1. #1
    Join Date
    May 2007

    Works in IE, not in FF

    This simple contact form works fine in IE but does not in FF. I cannot figure it out.

    The form does return false, and the variables make it into the url, but in firefox nothing else happens. It is as if the file is not being called, but the javascript is in firefox????? Please help if you can.

    Here is the javascript and the form

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <script type="text/javascript">
    function process_contact() {
    				var oForm = document.forms[0];
    				var oXmlHttp = zXmlHttp.createRequest();"POST",'process_contact.php', true);
    				var email = document.getElementById('contact_email').value;
    				var content = document.getElementById('contact_content').value;
    				var filled = document.getElementById('contact_filled').value;
    				oXmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    				//Set the function that will be called when the XmlHttpRequest objects state changes.
    				oXmlHttp.onreadystatechange = function () {
                    	if (oXmlHttp.readyState == 4) {
                        	if (oXmlHttp.status == 200) {
                            	document.getElementById('span_result').innerHTML = oXmlHttp.responseText;
                        	} else {
                            document.getElementById('span_result').innerHTML = "ERROR"
                	oXmlHttp.send('contact_email=' + email + '&contact_content=' + content + '&contact_filled=' + filled);
    <span id="span_result"></span>
    <div id="text">
    <form action="" method="post" onsubmit="javascript:process_contact(); return false">
    <!--<form method="post" action="" onsubmit="">-->
    <input name="contact_email" type="text" value="<? echo"$contact_email";?>" />
    <label>*Message</label><br />
    <textarea name="contact_content" id="contact_content" cols="30" rows="10"><? echo"$contact_content";?></textarea>
    <input type="hidden" name="contact_filled" id="contact_filled" value="filled" />
    <p align="center">
    <input type="submit" value="submit" />
    This is the .php file that should process the form

    $contact_filled = $_REQUEST['contact_filled'];
    if($contact_filled == "filled"){
    $contact_email = $_REQUEST['contact_email'];
    $contact_content = $_REQUEST['contact_content'];
    if($contact_email == "" or $contact_content == ""){
    $report = "Please fill in all *required fields.";
    } else {
    $insert = "INSERT INTO email SET
    email_id = '',
    email = '$contact_email'
    $resres = mysql_query($insert) or die ("err 12154587.023265");
    $to = "";
    $subj = "( Contact Message)";
    $head = "From: $contact_email <$contact_email>";
    $mess = "
    @mail($to, $subj, $mess, $head, $add) or die("Help Email Failed");
    $report = "Contact Message Sent. Thank You.";
    } else { echo"Filled not Filled."; } 
    Last edited by madchops1; May 22nd, 2007 at 01:57 AM.

  2. #2
    Join Date
    May 2007

    Re: Works in IE, not in FF

    I figured it out, I didn't have the id set to one of my text fields just a name. Firefox is touchy.

  3. #3
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002

    Re: Works in IE, not in FF

    Quote Originally Posted by madchops1
    Firefox is touchy.
    Yet another reason why it is better. It ensures accuracy.

    Glad you solved your problem. Please mark the thread resolved under the thread tools menu.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)