Jump to content

Firefox translation of email '@' in Get


jalea148

Recommended Posts

I’m using a Get to pass data to the next page. With Internet Explorer there are no problems. With Firefox, the @ symbol in the email address is translated into %40. This causes a problem in this snippet:

<input type="hidden" name="from" value="<?php echo $_GET['Email']; ?>"

 

[[email protected] comes through as customer%40alltel.net in Firefox]

What fixes are available? Thank you. Jay

Link to comment
https://forums.phpfreaks.com/topic/78099-firefox-translation-of-email-in-get/
Share on other sites

In the <form> tag, use POST instead of GET would be the obvious answer. Other than that, you can use a string function to convert the %40 back to an @ symbol.

 

PhREEEk

 

Something like this?

 

<input type="hidden" name="from" value="<?php echo strtr($_GET['Email'],'%40','@'); ?>"

 

  Jay

No... you need to convert it AFTER it is received by the processing script, and you need to use str_replace, not strstr...

 

The processing script...

<?php
if ( !empty($_GET['Email']) ) {
    $email = str_replace("%40", "@", $_GET['Email']);
}

 

Testing it...

 

<?php
$_GET['Email'] = 'customer%40alltel.net';
if ( !empty($_GET['Email']) ) {
    $email = str_replace("%40", "@", $_GET['Email']);
}
echo "Email = $email";
?>

 

PhREEEk

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.