MSUK1 Posted June 13, 2012 Share Posted June 13, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/264106-email-format-not-exporting-correctly/ Share on other sites More sharing options...
MSUK1 Posted June 13, 2012 Author Share Posted June 13, 2012 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>"; } Quote Link to comment https://forums.phpfreaks.com/topic/264106-email-format-not-exporting-correctly/#findComment-1353466 Share on other sites More sharing options...
ManiacDan Posted June 13, 2012 Share Posted June 13, 2012 Do you encode these or anything when you put them into the database? Have you looked at the data directly in the database to see if it's encoded weirdly in there? Where is the failure in this system? Quote Link to comment https://forums.phpfreaks.com/topic/264106-email-format-not-exporting-correctly/#findComment-1353469 Share on other sites More sharing options...
MSUK1 Posted June 13, 2012 Author Share Posted June 13, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/264106-email-format-not-exporting-correctly/#findComment-1353470 Share on other sites More sharing options...
MSUK1 Posted June 13, 2012 Author Share Posted June 13, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/264106-email-format-not-exporting-correctly/#findComment-1353477 Share on other sites More sharing options...
MSUK1 Posted June 13, 2012 Author Share Posted June 13, 2012 solved this by not using GET and used POST instead Quote Link to comment https://forums.phpfreaks.com/topic/264106-email-format-not-exporting-correctly/#findComment-1353502 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.