0

this is my code im using dreamweaver but i dont know how to add a data. . :(

<table width="98%" border="0" cellspacing="0" cellpadding="0">
  		<tr>
  		 
		  <td width="75%" valign="top" class="body">
		    <table cellpadding="3" cellspacing="0" border="0" width="100%">
					<tr>
						<td width="40%">
						<b>Choose username:</b></td>
						<td>
							<input type="text" name="user" size="20" tabindex="1" maxlength="25" />
						</td>
					</tr><tr>
						<td width="40%">
						<b>Email:</b></td>
						<td>
							<input type="text" name="email" size="30" tabindex="2" />
					    <label for="hideEmail"></label></td>
					</tr><tr>
						<td width="40%">
							<b>Choose password:</b>

						</td>
						<td>
							<input type="password" name="passwrd1" size="30" tabindex="3" />
						</td>
					</tr><tr>
						<td width="40%">
							<b>Verify password:</b>
						</td>

						<td>
							<input type="password" name="passwrd2" size="30" tabindex="4" />
						</td>
					</tr>
					<tr valign="top">
					  </tr>	<tr>
					
					</tr>
				</table>   
		    <div align="center">

		<input type="submit" name="regSubmit" value="Register" />
	</div>
		    
		    <p align="center" class="style4"><br />
		      <a href="content.html"></a></p></td>
	  	</tr>
		</table>

the name of the table i use is user,

inside the table of user is:
id
username
password
emailaddress

please help. . thanks. .

3
Contributors
7
Replies
8
Views
9 Years
Discussion Span
Last Post by ryan311
0

this is my code im using dreamweaver but i dont know how to add a data. . :(

<table width="98%" border="0" cellspacing="0" cellpadding="0">
  		<tr>
  		 
		  <td width="75%" valign="top" class="body">
		    <table cellpadding="3" cellspacing="0" border="0" width="100%">
					<tr>
						<td width="40%">
						<b>Choose username:</b></td>
						<td>
							<input type="text" name="user" size="20" tabindex="1" maxlength="25" />
						</td>
					</tr><tr>
						<td width="40%">
						<b>Email:</b></td>
						<td>
							<input type="text" name="email" size="30" tabindex="2" />
					    <label for="hideEmail"></label></td>
					</tr><tr>
						<td width="40%">
							<b>Choose password:</b>

						</td>
						<td>
							<input type="password" name="passwrd1" size="30" tabindex="3" />
						</td>
					</tr><tr>
						<td width="40%">
							<b>Verify password:</b>
						</td>

						<td>
							<input type="password" name="passwrd2" size="30" tabindex="4" />
						</td>
					</tr>
					<tr valign="top">
					  </tr>	<tr>
					
					</tr>
				</table>   
		    <div align="center">

		<input type="submit" name="regSubmit" value="Register" />
	</div>
		    
		    <p align="center" class="style4"><br />
		      <a href="content.html"></a></p></td>
	  	</tr>
		</table>

the name of the table i use is user,

inside the table of user is:
id
username
password
emailaddress

please help. . thanks. .

This are PHP codes.

if(isset($_POST['regSubmit'])) {

//get your post variables

$a=$_POST['user'];
$b=$_POST['email'];
$c=$_POST['passwrd1'];
$d=$_POST['passwrd2'];

//verify the password if the same
if($c != $d) { die('password mismatch'); };

//encrypt your password
$e = md5($c);

//Connect to your database
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}

mysql_select_db("mydb");

//make sure you have the same column number in inserting values
$result = mysql_query("INSERT INTO USER VALUES('$a', '$c', '$b'");

if(!$result) $_SESSION['success'] = '1'; 

mysql_close($conn);
}


if($_SESSION['success'] == '1') {
echo "Failed!";
//or HTML put here
} else {
//or HTML put here
echo "Success!";
}

NOTE: read addslashes, stripslashes and !get_magic_quotes_gpc if you want to use them.

if(!get_magic_quotes_gpc()){
$username = addslashes($username);
}
INSERT command here...

if you want to get it those value use stripslashes.

if you want good form validation:
visit this link: http://www.javascript-coder.com/html-form/javascript-form-validation.phtml

or you download this .. http://sourceforge.net/projects/phploginsystemw/

if you want OBJECT ORIENTED....

0

where should i put this code? to my register form? or another php script?

0

where should i put this code? to my register form? or another php script?

to your register form make sure the action="" of your form is empty or use the PHP_SELF.

0

yahh its empty should i create a new php script and put that code in to it? and how can i call that script?

0

sir rm can u give me a simple sample on it? please? please please please?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.