CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2007
    Posts
    5

    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

    Code:
    <!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=iso-8859-1" />
    <title>Untitled Document</title>
    
    <script type="text/javascript">
    function process_contact() {
    				var oForm = document.forms[0];
    				var oXmlHttp = zXmlHttp.createRequest();
    				oXmlHttp.open("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);
    				}
    </script>
    
    
    
    </head>
    <body>
    <span id="span_result"></span>
    
    <div id="text">
    <form action="" method="post" onsubmit="javascript:process_contact(); return false">
    <!--<form method="post" action="" onsubmit="">-->
    <p>
    <label>*Email</label>
    <input name="contact_email" type="text" value="<? echo"$contact_email";?>" />
    </p>
    
    
    <p>
    <label>*Message</label><br />
    <textarea name="contact_content" id="contact_content" cols="30" rows="10"><? echo"$contact_content";?></textarea>
    </p>
    
    <input type="hidden" name="contact_filled" id="contact_filled" value="filled" />
    
    <p align="center">
    <input type="submit" value="submit" />
    </p>
    </form>
    </div>
    
    
    </body>
    </html>
    
    
    
    <!-- END JAVASCRIPT AND FORM -->
    ///////////////////////////////////////////////////////////////////
    This is the .php file that should process the form





    Code:
    <?
    include'functions.php';
    $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 = "madchops11@yahoo.com";
    $subj = "(KarlSteltenpohl.com Contact Message)";
    $head = "From: $contact_email <$contact_email>";
    $mess = "
    $contact_content
    ";
    
    @mail($to, $subj, $mess, $head, $add) or die("Help Email Failed");
    $report = "Contact Message Sent. Thank You.";
    }
    report($report);
    } else { echo"Filled not Filled."; } 
    ?>
    Last edited by madchops1; May 22nd, 2007 at 01:57 AM.

  2. #2
    Join Date
    May 2007
    Posts
    5

    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
    Join Date
    May 2002
    Posts
    10,943

    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
  •  





Click Here to Expand Forum to Full Width

Featured