Jump to content

Recommended Posts

Code Submits and words ONLY in firefox and I am not sure why.

 

The script fails to submit at all under IE and does submit under google chrome but does not send an email at all. In firefox which I tested it in it works great. Pretty big problem considering the function of the form is the only purpose of the website. Any help would be very appreciated.

 

<?php

//Credit goes to http://www.thesitewizard.com for their fantastic script

 

 

// ------------- CONFIGURABLE SECTION ------------------------

 

// $mailto - set to the email address you want the form

// sent to, eg

//$mailto = "youremailaddress@example.com" ;

 

$mailto = 'HIDDEN REAL EMAIL' ;

 

// $subject - set to the Subject line of the email, eg

//$subject = "Feedback Form" ;

 

$subject = "Contact Form" ;

 

// the pages to be displayed, eg

//$formurl = "http://www.example.com/feedback.html" ;

//$errorurl = "http://www.example.com/error.html" ;

//$thankyouurl = "http://www.example.com/thankyou.html" ;

 

$formurl = "HIDDEN" ;

$errorurl = "HIDDEN" ;

$thankyouurl = "HIDDEN" ;

 

$email_is_required = 1;

$name_is_required = 1;

$comments_is_required = 0;

$phone_is_required = 1;

$cell_is_required = 0;

$work_is_required = 0;

$uself = 0;

$use_envsender = 0;

$use_sendmailfrom = 0;

$use_webmaster_email_for_from = 0;

$use_utf8 = 1;

$my_recaptcha_private_key = '' ;

$show_ip_hostname = TRUE;

 

 

// -------------------- END OF CONFIGURABLE SECTION ---------------

 

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;

$content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ;

if (!isset( $use_envsender )) { $use_envsender = 0 ; }

if (isset( $use_sendmailfrom ) && $use_sendmailfrom) {

ini_set( 'sendmail_from', $mailto );

}

$envsender = "-f$mailto" ;

$fullname = (isset($_POST['fullname']))? $_POST['fullname'] : $_POST['name'] ;

$email = $_POST['email'] ;

$phone = $_POST['phone'] ;

$cell = $_POST['cell'] ;

$work = $_POST['work'] ;

$comments = $_POST['comments'] ;

$http_referrer = getenv( "HTTP_REFERER" );

$show_ip_hostname = TRUE;

$size  =  $_POST['size'];

 

if( isset( $_POST["submitForm"] ) || isset( $_POST["submitForm_x"] ) ) 

 

if (!isset($_POST['email'])) {

header( "Location: $formurl" );

exit ;

}

if (($email_is_required && (empty($email) || !preg_match('/@/', $email))) || ($name_is_required && empty($fullname)) || ($comments_is_required && empty($comments))) {

header( "Location: $errorurl" );

exit ;

}

if ( preg_match( "/[\r\n]/", $fullname ) || preg_match( "/[\r\n]/", $email ) ) {

header( "Location: $errorurl" );

exit ;

}

if (strlen( $my_recaptcha_private_key )) {

require_once( 'recaptchalib.php' );

$resp = recaptcha_check_answer ( $my_recaptcha_private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] );

if (!$resp->is_valid) {

header( "Location: $errorurl" );

exit ;

}

}

if (empty($email)) {

$email = $mailto ;

}

$fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email : $mailto ;

 

if (function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc()) {

$comments = stripslashes( $comments );

}

 

 

 

if ($show_ip_hostname) {

$mail_message .= 'IP: ' . $_SERVER['REMOTE_ADDR'] . "\n" . 'HOST: ' . gethostbyaddr($_SERVER['REMOTE_ADDR']) . "\n";

}

 

$messageproper =

"This message was sent from:\n" .

"$http_referrer\n" .

"$show_ip_hostname\n" .

 

"------------------------------------------------------------\n" .

"Name of sender: $fullname\n" .

"------------------------------------------------------------\n" .

"Email of sender: $email\n" .

"------------------------------------------------------------\n" .

"Home Phone Number of sender: $phone\n" .

"------------------------------------------------------------\n" .

"Cell Phone Number of sender: $cell\n" .

"------------------------------------------------------------\n" .

"Work Phone Number of sender: $work\n" .

"------------------------------------------------------------\n" .

"Portfolio Size: $size\n" .

"------------------------- Interests -------------------------\n\n" .

$comments .

"\n\n------------------------------------------------------------\n" ;

 

$headers =

"From: \"$fullname\" <$fromemail>" . $headersep . "Reply-To: \"$fullname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.15.0" .

$headersep . 'MIME-Version: 1.0' . $headersep . $content_type ;

 

if ($use_envsender) {

mail($mailto, $subject, $messageproper, $headers, $envsender );

}

 

else {

mail($mailto, $subject, $messageproper, $headers );

}

header( "Location: $thankyouurl" );

exit ;

 

 

 

?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/172410-code-only-works-in-firefox/
Share on other sites

So, what is the form that submits the data? It is likely invalid HTML and FF ignores the errors in it and works, while IE sees the incorrect HTML and does not work. Your form processing code (what you posted) only operates on what it is given. It is the form where the problem lies.

So, what is the form that submits the data? It is likely invalid HTML and FF ignores the errors in it and works, while IE sees the incorrect HTML and does not work. Your form processing code (what you posted) only operates on what it is given. It is the form where the problem lies.

 

<form class="cmxform" id="commentForm" form action="freeinfo.php" method="post">

 

<table border="0" cellpadding="5" cellspacing="4" summary="feedback form">

 

<tr><td width="106">

 

<label for="tswname">Name<span class="style1">*</span></label>

:</td><td width="170">

 

<input type="text" name="fullname" id="tswname" size="25" class="required" />

 

</td></tr>     

 

<tr><td>

 

<label for="tswemail">Email address<span class="style1">*</span></label>:</td><td>

<input type="text" id="tswemail" name="email" size="25" class="required email" />

 

</td></tr>

 

<tr><td>

 

<label for="tswcomments">Home Phone Number<span class="style1">*</span></label>:</td><td>

<input type="text" id="field" name="phone" size="25" class="required phoneUS" />

 

</td></tr>

 

<tr><td>

 

<label for="tswemail">Cell Phone Number<span class="style1"></span></label>:</td><td><input type="text" id="tswemail" name="cell" size="25" />

 

</td></tr>

 

<tr><td>

 

<label for="tswemail">Work Phone Number <span class="style1"></span></label>:</td>

<td><input type="text" id="tswemail" name="work" size="25" />

 

</td></tr>

 

<tr>

 

<td colspan="2">

 

<label for="tswcomments">Trading Experience<span class="style1">*</span> (Check all that apply):<br />

 

 

 

</label>

 

<label>

                 

<input type="checkbox" name="stocks" id="stocks" />Stocks

  

</label>

   

<input type="checkbox" name="bonds" id="bonds" /><label for="tswcomments">Bonds</label>

 

<label>

 

 

 

</label>

<br />

<label for="label"></label>

                 

 

<input type="checkbox" name="futures" id="futures" /><label for="tswcomments">Futures</label>

 

<label>

 

 

 

</label>

 

<label for="label"></label>

 

<label for="tswcomments"></label>

    

<input type="checkbox" name="forex" id="forex" /><label for="tswcomments">Forex</label>

 

<label>

 

 

 

</label>

<label for="label"></label>

<label for="tswcomments"><br />

</label>

<label for="tswcomments"></label>

 

 

<label><br />

 

<form method='post' action='freeinfo.php'>

 

Portfolio Size

 

<span class="style1">*</span>: <select name="size" size="1">

 

<option>$5,000-$10,000</option>

<option>$10,000-$50,000</option>

<option>$50,000-$100,000</option>

<option>$100,000-$250,000</option>

<option>$250,000-$500,000</option>

<option>$750,000-$1,000,000</option>

<option>$1,000,000+</option>

 

</select>

 

<br>

 

</form>

 

</label>

 

<label for="tswcomments"><br /></label>

 

Investment Goals (Optional):</label>

 

<br />

 

<textarea rows="3" cols="40" name="comments" id="tswcomments"></textarea></td>

 

</tr>

 

<tr>

 

<td height="40" colspan="2" align="center">

 

<input type="submit" value="Submit" /><br />

 

<br />

 

</td>

 

</tr>

 

</table>

 

</form>

 

I looked at the HTML form code and tried to remove what is in bold

 

I figured those parameters were messing it up, so now it submits but I get an internal server error.

 

<form method='post' action='freeinfo.php'>

Portfolio Size

 

<span class="style1">*</span>: <select name="size" size="1">

 

<option>$5,000-$10,000</option>

<option>$10,000-$50,000</option>

<option>$50,000-$100,000</option>

<option>$100,000-$250,000</option>

<option>$250,000-$500,000</option>

<option>$750,000-$1,000,000</option>

<option>$1,000,000+</option>

 

</select>

 

<br>

 

</form>

 

 

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.