help how to add a data or insert a data

Reply

Join Date: Jul 2008
Posts: 161
Reputation: ryan311 has a little shameless behaviour in the past 
Solved Threads: 1
ryan311 ryan311 is offline Offline
Junior Poster

help how to add a data or insert a data

 
0
  #1
Apr 6th, 2009
this is my code im using dreamweaver but i dont know how to add a data. .

Graphics and Multimedia Syntax (Toggle Plain Text)
  1. <table width="98%" border="0" cellspacing="0" cellpadding="0">
  2. <tr>
  3.  
  4. <td width="75%" valign="top" class="body">
  5. <table cellpadding="3" cellspacing="0" border="0" width="100%">
  6. <tr>
  7. <td width="40%">
  8. <b>Choose username:</b></td>
  9. <td>
  10. <input type="text" name="user" size="20" tabindex="1" maxlength="25" />
  11. </td>
  12. </tr><tr>
  13. <td width="40%">
  14. <b>Email:</b></td>
  15. <td>
  16. <input type="text" name="email" size="30" tabindex="2" />
  17. <label for="hideEmail"></label></td>
  18. </tr><tr>
  19. <td width="40%">
  20. <b>Choose password:</b>
  21.  
  22. </td>
  23. <td>
  24. <input type="password" name="passwrd1" size="30" tabindex="3" />
  25. </td>
  26. </tr><tr>
  27. <td width="40%">
  28. <b>Verify password:</b>
  29. </td>
  30.  
  31. <td>
  32. <input type="password" name="passwrd2" size="30" tabindex="4" />
  33. </td>
  34. </tr>
  35. <tr valign="top">
  36. </tr> <tr>
  37.  
  38. </tr>
  39. </table>
  40. <div align="center">
  41.  
  42. <input type="submit" name="regSubmit" value="Register" />
  43. </div>
  44.  
  45. <p align="center" class="style4"><br />
  46. <a href="content.html"></a></p></td>
  47. </tr>
  48. </table>

the name of the table i use is user,

inside the table of user is:
id
username
password
emailaddress

please help. . thanks. .
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 3,203
Reputation: MidiMagic has a spectacular aura about MidiMagic has a spectacular aura about 
Solved Threads: 164
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Nearly a Senior Poster

Re: help how to add a data or insert a data

 
0
  #2
Apr 6th, 2009
What's a data? Or is it, "what's a datum?"

I have no idea what you want.
Daylight-saving time uses more gasoline
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 164
Reputation: rm_daniweb is an unknown quantity at this point 
Solved Threads: 10
rm_daniweb rm_daniweb is offline Offline
Junior Poster

Re: help how to add a data or insert a data

 
0
  #3
Apr 6th, 2009
Originally Posted by ryan311 View Post
this is my code im using dreamweaver but i dont know how to add a data. .

Graphics and Multimedia Syntax (Toggle Plain Text)
  1. <table width="98%" border="0" cellspacing="0" cellpadding="0">
  2. <tr>
  3.  
  4. <td width="75%" valign="top" class="body">
  5. <table cellpadding="3" cellspacing="0" border="0" width="100%">
  6. <tr>
  7. <td width="40%">
  8. <b>Choose username:</b></td>
  9. <td>
  10. <input type="text" name="user" size="20" tabindex="1" maxlength="25" />
  11. </td>
  12. </tr><tr>
  13. <td width="40%">
  14. <b>Email:</b></td>
  15. <td>
  16. <input type="text" name="email" size="30" tabindex="2" />
  17. <label for="hideEmail"></label></td>
  18. </tr><tr>
  19. <td width="40%">
  20. <b>Choose password:</b>
  21.  
  22. </td>
  23. <td>
  24. <input type="password" name="passwrd1" size="30" tabindex="3" />
  25. </td>
  26. </tr><tr>
  27. <td width="40%">
  28. <b>Verify password:</b>
  29. </td>
  30.  
  31. <td>
  32. <input type="password" name="passwrd2" size="30" tabindex="4" />
  33. </td>
  34. </tr>
  35. <tr valign="top">
  36. </tr> <tr>
  37.  
  38. </tr>
  39. </table>
  40. <div align="center">
  41.  
  42. <input type="submit" name="regSubmit" value="Register" />
  43. </div>
  44.  
  45. <p align="center" class="style4"><br />
  46. <a href="content.html"></a></p></td>
  47. </tr>
  48. </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...lidation.phtml

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

if you want OBJECT ORIENTED....
Last edited by rm_daniweb; Apr 6th, 2009 at 4:59 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 161
Reputation: ryan311 has a little shameless behaviour in the past 
Solved Threads: 1
ryan311 ryan311 is offline Offline
Junior Poster

Re: help how to add a data or insert a data

 
0
  #4
Apr 6th, 2009
where should i put this code? to my register form? or another php script?
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 164
Reputation: rm_daniweb is an unknown quantity at this point 
Solved Threads: 10
rm_daniweb rm_daniweb is offline Offline
Junior Poster

Re: help how to add a data or insert a data

 
0
  #5
Apr 9th, 2009
Originally Posted by ryan311 View Post
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 161
Reputation: ryan311 has a little shameless behaviour in the past 
Solved Threads: 1
ryan311 ryan311 is offline Offline
Junior Poster

Re: help how to add a data or insert a data

 
0
  #6
Apr 10th, 2009
yahh its empty should i create a new php script and put that code in to it? and how can i call that script?
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 164
Reputation: rm_daniweb is an unknown quantity at this point 
Solved Threads: 10
rm_daniweb rm_daniweb is offline Offline
Junior Poster

Re: help how to add a data or insert a data

 
0
  #7
Apr 10th, 2009
just click your Register button...
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 161
Reputation: ryan311 has a little shameless behaviour in the past 
Solved Threads: 1
ryan311 ryan311 is offline Offline
Junior Poster

Re: help how to add a data or insert a data

 
0
  #8
Apr 11th, 2009
sir rm can u give me a simple sample on it? please? please please please?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC