Jump to content

Allow user to change email


siftyzod
Go to solution Solved by siftyzod,

Recommended Posts

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 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Solution

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

Link to comment
Share on other sites

<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
?>
Link to comment
Share on other sites

<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 

Link to comment
Share on other sites

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 

Link to comment
Share on other sites

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.