搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

I created a website RSVP form with PHP script that works in Safari and Chrome, but not in Firefox

  • 4 回覆
  • 1 有這個問題
  • 1 次檢視
  • 最近回覆由 ntaflove

more options

I'm creating a website RSVP form for my wedding. The site sends the form's data to my email. Most of the data comes through, but the "attending" field only appears in the email on Safari and Chrome -- but not on Firefox (version 18.0) !

Here's the html code for the "attending" buttons:

<input name="action" type="image" id="submit" value="attending" src="accepts.png" alt="Submit form" align="top" />
      <input name="action" type="image" id="submit" value="not attending" src="declines.png" alt="Submit form" align="middle" />

And here's the entire PHP code:

<?php 

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

$mailto = 'yourname@gmail.com' ;
$subject = "You received an RSVP" ;
$formurl = "http://yoursite.com/RSVP.html" ;
$thankyouurl = "http://yoursite.com/thankyou.html" ;
$errorurl = "http://yoursite.com/error.html" ;

$email_is_required = 0;
$name_is_required = 0;
$comments_is_required = 0;
$uself = 0;
$forcelf = 0;
$use_envsender = 0;
$use_sendmailfrom = 0;
$smtp_server_win = '' ;
$use_webmaster_email_for_from = 0;
$use_utf8 = 1;
$my_recaptcha_private_key = '' ;

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

define( 'MAX_LINE_LENGTH', 998 );
$headersep = $uself ? "\n" : "\r\n" ;
$content_nl = $forcelf ? "\n" : (defined('PHP_EOL') ? PHP_EOL : "\n") ;
$content_type = $use_utf8 ? 'Content-Type: text/plain; charset="utf-8"' : 'Content-Type: text/plain; charset="iso-8859-1"' ;
if ($use_sendmailfrom) {
 ini_set( 'sendmail_from', $mailto );
}
if (strlen($smtp_server_win)) {
 ini_set( 'SMTP', $smtp_server_win );
}
$envsender = "-f$mailto" ;
$fullname = isset($_POST['fullname']) ? $_POST['fullname'] : $_POST['name'] ;
$numberguests = $_POST['numberparty'] ;
$attending = $_POST['action'];
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );

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 ;
 }
}

$fromemail = $use_webmaster_email_for_from ? $mailto : $email ;

if (function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc()) {
 $comments = stripslashes( $comments );
}

$messageproper =
 "This message was sent from:" . $content_nl .
 "$http_referrer" . $content_nl .
 "------------------------------------------------------------" . $content_nl .
 "Name of sender: $fullname" . $content_nl .
 "Number of guests: $numberguests" . $content_nl .
 "Attending: $attending" . $content_nl .
 "------------------------- COMMENTS -------------------------" . $content_nl . $content_nl .
 
 wordwrap( $comments, MAX_LINE_LENGTH, $content_nl, true ) . $content_nl . $content_nl .
 "------------------------------------------------------------" . $content_nl ;

$headers =
 "From: \"$fullname\" <$fromemail>" . $headersep . "Reply-To: \"$fullname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.16.2" .
 $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 ;

?>
I'm creating a website RSVP form for my wedding. The site sends the form's data to my email. Most of the data comes through, but the "attending" field only appears in the email on Safari and Chrome -- but not on Firefox (version 18.0) ! Here's the html code for the "attending" buttons: <pre><nowiki><input name="action" type="image" id="submit" value="attending" src="accepts.png" alt="Submit form" align="top" /> <input name="action" type="image" id="submit" value="not attending" src="declines.png" alt="Submit form" align="middle" /> </nowiki></pre> And here's the entire PHP code: <pre><nowiki><?php // ------------- CONFIGURABLE SECTION ------------------------ $mailto = 'yourname@gmail.com' ; $subject = "You received an RSVP" ; $formurl = "http://yoursite.com/RSVP.html" ; $thankyouurl = "http://yoursite.com/thankyou.html" ; $errorurl = "http://yoursite.com/error.html" ; $email_is_required = 0; $name_is_required = 0; $comments_is_required = 0; $uself = 0; $forcelf = 0; $use_envsender = 0; $use_sendmailfrom = 0; $smtp_server_win = '' ; $use_webmaster_email_for_from = 0; $use_utf8 = 1; $my_recaptcha_private_key = '' ; // -------------------- END OF CONFIGURABLE SECTION --------------- define( 'MAX_LINE_LENGTH', 998 ); $headersep = $uself ? "\n" : "\r\n" ; $content_nl = $forcelf ? "\n" : (defined('PHP_EOL') ? PHP_EOL : "\n") ; $content_type = $use_utf8 ? 'Content-Type: text/plain; charset="utf-8"' : 'Content-Type: text/plain; charset="iso-8859-1"' ; if ($use_sendmailfrom) { ini_set( 'sendmail_from', $mailto ); } if (strlen($smtp_server_win)) { ini_set( 'SMTP', $smtp_server_win ); } $envsender = "-f$mailto" ; $fullname = isset($_POST['fullname']) ? $_POST['fullname'] : $_POST['name'] ; $numberguests = $_POST['numberparty'] ; $attending = $_POST['action']; $comments = $_POST['comments'] ; $http_referrer = getenv( "HTTP_REFERER" ); 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 ; } } $fromemail = $use_webmaster_email_for_from ? $mailto : $email ; if (function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "This message was sent from:" . $content_nl . "$http_referrer" . $content_nl . "------------------------------------------------------------" . $content_nl . "Name of sender: $fullname" . $content_nl . "Number of guests: $numberguests" . $content_nl . "Attending: $attending" . $content_nl . "------------------------- COMMENTS -------------------------" . $content_nl . $content_nl . wordwrap( $comments, MAX_LINE_LENGTH, $content_nl, true ) . $content_nl . $content_nl . "------------------------------------------------------------" . $content_nl ; $headers = "From: \"$fullname\" <$fromemail>" . $headersep . "Reply-To: \"$fullname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.16.2" . $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 ; ?></nowiki></pre>

由 ntaflove 於 修改

被選擇的解決方法

Hello,

There should be an update to version 18.0.1 shortly which I believe should fix this issue.

Sorry for any inconveniences.

從原來的回覆中察看解決方案 👍 1

所有回覆 (4)

more options

Hey there!

Just a quick heads up that you don't want to post your email address here. I can see the ___ of us "attending". Is that the part you are saying that you can not see on the website? I can see it fine. Do your guests experience the issue or is it just you? Here are some quick troubleshooting steps you can try.

Many site issues can be caused by corrupt cookies or cache. In order to try to fix these problems, the first step is to clear both cookies and the cache. Note: This will temporarily log you out of all sites you're logged in to. To clear cache and cookies do the following:


  1. Go to Firefox > History > Clear recent history or (if no Firefox button is shown) go to Tools > Clear recent history.
  2. Under "Time range to clear", select "Everything".
  3. Now, click the arrow next to Details to toggle the Details list active.
  4. From the details list, check Cache and Cookies and uncheck everything else.
  5. Now click the Clear now button.

Further information can be found in the Clear your cache, history and other personal information in Firefox article.


Did this fix your problems? Please report back to us!

Please check if all your plugins are up-to-date. To do this, go to the Mozilla Plugin Check site.

Once you're there, the site will check if all your plugins have the latest versions. If you see plugins in the list that have a yellow Update button or a red Update now button, please update these immediately.

To do so, please click each red or yellow button. Then you should see a site that allows you to download the latest version. Double-click the downloaded file to start the installation and follow the steps mentioned in the installation procedure.

Try the Firefox Safe Mode to see how it works there. The Safe Mode is a troubleshooting mode, which disables most add-ons.

(If you're not using it, switch to the Default theme.)

  • You can open the Firefox 4.0+ Safe Mode by holding the Shift key when you use the Firefox desktop or Start menu shortcut.
  • Or use the Help menu item and click on the Restart with Add-ons Disabled... menu item while Firefox is running.

Don't select anything right now, just use "'Start in Safe Mode" To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shift key) to open it again. If it is good in the Firefox Safe Mode, your problem is probably caused by an extension, and you need to figure out which one.

Please follow the Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems article for that.

When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.

由 Andrew 於 修改

more options

I'm sorry. I probably wasn't as specific as I should have been. The issue isn't with the "number of guests attending" section of the form. Each guest must input three items on the form-- (1) their name, (2) the number of guests attending, and (3) whether or not they accept or decline the invite. The email I receive from Firefox when a user submits the form displays 1 and 2 perfectly. It's 3 that's not showing up. I need the email I receive from each guest to say either "attending" or "not attending" depending on whether they click the "accept" or "decline" on the webpage.

more options

選擇的解決方法

Hello,

There should be an update to version 18.0.1 shortly which I believe should fix this issue.

Sorry for any inconveniences.

more options

Thanks so much feer. I'm worried that, even if I upgrade to the latest version of Firefox where this bug is fixed, many of the wedding guests will still be using earlier versions where this is still a problem. Can you recommend any alternative html/php coding that I can use for "image/submit form" buttons that work in all major browsers?

I really appreciate your support. 

Thanks again,

Nate