siftyzod Posted May 1, 2014 Share Posted May 1, 2014 I am trying to work out how to do a form to allow a user to change their email address .... i have no idea where to start and if anyone can help me out with it please add me on skype glenn.sutton74 i cant imagine it being hard Quote Link to comment https://forums.phpfreaks.com/topic/288151-allow-user-to-change-email/ Share on other sites More sharing options...
Oliverkahn Posted May 1, 2014 Share Posted May 1, 2014 this is the sample code for the html part.... <form name="frm1" method="post" action="#"> <label for="email">change email</label><input type="email" name="new_email" value=""> <input type="submit" name="submit" value="change email"> php part <?php require_once("connect.php"); if(isset($_POST['submit'])) $sql="UPDATE email=$new_email FROM tb_name WHERE username=$username"; mysql_query($sql); echo "email successfully updated"; ?> note: thats just a sample script...if you want to use this you need to modify it Quote Link to comment https://forums.phpfreaks.com/topic/288151-allow-user-to-change-email/#findComment-1477788 Share on other sites More sharing options...
siftyzod Posted May 1, 2014 Author Share Posted May 1, 2014 not so simple ...i will have a crack at it with this code (hoping u cant toast a database) as this is my first time ever doing code ..wish me luck Quote Link to comment https://forums.phpfreaks.com/topic/288151-allow-user-to-change-email/#findComment-1477789 Share on other sites More sharing options...
Oliverkahn Posted May 1, 2014 Share Posted May 1, 2014 good luck bro Quote Link to comment https://forums.phpfreaks.com/topic/288151-allow-user-to-change-email/#findComment-1477794 Share on other sites More sharing options...
Solution siftyzod Posted May 1, 2014 Author Solution Share Posted May 1, 2014 good luck bro Lol i have decided its way over my head ... i think i will stick to my little bars i can add in at the moment and let someone else do this .. cause i dont even understand what any of php code does i just copy and paste and play till it works cheers anyway Quote Link to comment https://forums.phpfreaks.com/topic/288151-allow-user-to-change-email/#findComment-1477795 Share on other sites More sharing options...
Oliverkahn Posted May 1, 2014 Share Posted May 1, 2014 <form name="frm1" method="post" action="#"> <label for="email">change email</ label><input type="email" name=" new_email" value=""> <input type="submit" name="submit " value="change email"> //am sure you understand the html part ……………………………………………………………………php part <?php require_once("connect.php"); //this include your database connection if(isset($_POST['submit'])) //check if the submit button is being clicked //if the submit button is clicked, the following code will run $sql="UPDATE email=$new_email FROM tb_name WHERE username=$ username"; //set a query to select and update the database and store it in a variable called $sql at the left mysql_query($sql); //send the query above to the database echo "email successfully updated "; //print some text out to the browser after updating the database ?> Quote Link to comment https://forums.phpfreaks.com/topic/288151-allow-user-to-change-email/#findComment-1477797 Share on other sites More sharing options...
siftyzod Posted May 1, 2014 Author Share Posted May 1, 2014 <form name="frm1" method="post" action="#"> <label for="email">change email</ label><input type="email" name=" new_email" value=""> <input type="submit" name="submit " value="change email"> //am sure you understand the html part ……………………………………………………………………php part <?php require_once("connect.php"); //this include your database connection if(isset($_POST['submit'])) //check if the submit button is being clicked //if the submit button is clicked, the following code will run $sql="UPDATE email=$new_email FROM tb_name WHERE username=$ username"; //set a query to select and update the database and store it in a variable called $sql at the left mysql_query($sql); //send the query above to the database echo "email successfully updated "; //print some text out to the browser after updating the database ?> lol i understand none of it ... i did my first php boarder bar thingee today and took me 2hrs to get it to work ... i have never worked on a website before Quote Link to comment https://forums.phpfreaks.com/topic/288151-allow-user-to-change-email/#findComment-1477798 Share on other sites More sharing options...
Oliverkahn Posted May 1, 2014 Share Posted May 1, 2014 then i advice you to start learning programming @w3chools.com Quote Link to comment https://forums.phpfreaks.com/topic/288151-allow-user-to-change-email/#findComment-1477799 Share on other sites More sharing options...
siftyzod Posted May 1, 2014 Author Share Posted May 1, 2014 then i advice you to start learning programming @w3chools.com dont really think its something i can learn to do ...its way to much to remember ... i dont even remember what day it is half the time .... i think i will just leave the coding to people who know what they are doing im to old to start learning this kind of stuff Quote Link to comment https://forums.phpfreaks.com/topic/288151-allow-user-to-change-email/#findComment-1477800 Share on other sites More sharing options...
Oliverkahn Posted May 1, 2014 Share Posted May 1, 2014 do you mean you are an old man??…………how old are you?? Quote Link to comment https://forums.phpfreaks.com/topic/288151-allow-user-to-change-email/#findComment-1477804 Share on other sites More sharing options...
siftyzod Posted May 1, 2014 Author Share Posted May 1, 2014 do you mean you are an old man??…………how old are you?? im to old to start learning things like this thats for sure Quote Link to comment https://forums.phpfreaks.com/topic/288151-allow-user-to-change-email/#findComment-1477805 Share on other sites More sharing options...
Oliverkahn Posted May 1, 2014 Share Posted May 1, 2014 Ok Quote Link to comment https://forums.phpfreaks.com/topic/288151-allow-user-to-change-email/#findComment-1477806 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.