JAGF - Just A General Forum

It is currently Jan 6th, '09, 11:59 • All times are UTC + 1 hour






Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: [php][webdesign][3]-check 2 input field are the same
PostPosted: Nov 1st, '08, 20:27 
Offline
New Gamer

Joined: Oct 31st, '08, 14:28
Posts: 42
Highscores: 24
How did you find this forum?: x10 forums
When you have a register system you usually want user to comfirm their password and e-mail sometimes user name this make sure the user put in what they really want

so there need to be a HTML form to have a input box

Code:
    <form action="register.php" method="post">
    <input type="hidden" name="page_mode" value="register">

Password
<input type="password" name="password" size="30">

Confirm Password
<input type="password" name="conf_password" size="30">


<input type="submit" value="Register" size="30">

    </form>


this is a very basic form and now we need to tell the browser to change the inputs to php form so we can use them easily

$password = $_POST['password'];
$conf_password = $_POST['conf_password'];

if ($password != $conf_password)
$error_string .= 'The password and confirmation password do not match.';

You can put else register something like that but the main part is checking if it the same and NOT the same is !=
or you can do

if ($password == $conf_password)
echo 'two password are the same!'

**== mean exactly the same 1=1 2=2
= mean like is error_string . IS the password don't match..
________________
TO BE MORE ORGANIZE :
$error_string . is like a Variables that say error you can do

if ($password != $conf_password)
echo 'The password and confirmation password do not match.<br>';

if you do this then you will put the all those code in the middle of the HTML form, because it echo at where you put the code. so I have this error_string. I will put <?php echo $error_string; ?> at the middle of HTML instead of those code.
_________________
Image


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.

Design by phpBB 3 Skins & Forum Hosting | Modded by ExchangeCore

CSS Template by RamblingSoul | Sponsored By Bargain Finder