Jump to content

Recommended Posts

Hello

 

I am using a function to get a users email from a database, in the database it is stored as email@domain.com, when i pull this down from the database, and insert it into a select field it turns the value to email%2540domain.com %2540 = @ sign (im guessing)

 

does anyone know why this is happening?

 

All help appreciated

Link to comment
https://forums.phpfreaks.com/topic/264106-email-format-not-exporting-correctly/
Share on other sites

sample function

 

function displayLeaders($usern){

   global $database;
   $q = "SELECT * "
       ."FROM ".TBL_USERS." WHERE userlevel = '5'";
   $result = $database->query($q);
   /* Error occurred, return given name by default */
   $num_rows = mysql_numrows($result);
   if(!$result || ($num_rows < 0)){
      echo "Error displaying info";
      return;
   }
   if($num_rows == 0){
      echo "Database table empty";
      return;
   }
   /* Display table contents */
   echo "<select onchange=\"document.leaders_email.submit()\" name=\"emailLeader\" id=\"emailLeader\" placeholder=\"Select A Leader\" class=\"{validate:{required:true}}\">\n";
   echo "<option value=\"\">Please Choose A Leader</option>\n";
   for($i=0; $i<$num_rows; $i++){
      $LMusername = mysql_result($result,$i,"username");
      $LMemail = mysql_result($result,$i,"email");
      echo "<option value=\"$LMemail\">$LMusername ( $LMemail )</option>\n";
   }
      echo "</select>";
}

the data in the DB is fine,

 

I think the problem is coming from the select form.

 

I have written the "on change" function which submits the form on change

 

it is converting any symbol &^%$£@!!@£ into its symbol value

 

is there a way to prevent this? i believe this is the failure

just to simple things up,

 

ive been looking around online 10-15 websites, and finally found what the problem is, but no solution.

 

It looks as if my url is being double encoded the % to 25 and the @ to 40, producing %2540

 

is anyone familiar with solving this

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.