943,645 Members | Top Members by Rank

Ad:
Apr 6th, 2009
0

help how to add a data or insert a data

Expand 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. .
Similar Threads
Reputation Points: 3
Solved Threads: 5
Posting Whiz in Training
ryan311 is offline Offline
254 posts
since Jul 2008
Apr 6th, 2009
0

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

What's a data? Or is it, "what's a datum?"

I have no idea what you want.
Reputation Points: 730
Solved Threads: 181
Nearly a Senior Poster
MidiMagic is offline Offline
3,314 posts
since Jan 2007
Apr 6th, 2009
0

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

Click to Expand / Collapse  Quote originally posted by ryan311 ...
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!";
}

Quote ...
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.
Reputation Points: 13
Solved Threads: 12
Junior Poster
rm_daniweb is offline Offline
165 posts
since Jan 2007
Apr 6th, 2009
0

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

where should i put this code? to my register form? or another php script?
Reputation Points: 3
Solved Threads: 5
Posting Whiz in Training
ryan311 is offline Offline
254 posts
since Jul 2008
Apr 9th, 2009
0

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

Click to Expand / Collapse  Quote originally posted by ryan311 ...
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.
Reputation Points: 13
Solved Threads: 12
Junior Poster
rm_daniweb is offline Offline
165 posts
since Jan 2007
Apr 10th, 2009
0

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

yahh its empty should i create a new php script and put that code in to it? and how can i call that script?
Reputation Points: 3
Solved Threads: 5
Posting Whiz in Training
ryan311 is offline Offline
254 posts
since Jul 2008
Apr 10th, 2009
0

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

just click your Register button...
Reputation Points: 13
Solved Threads: 12
Junior Poster
rm_daniweb is offline Offline
165 posts
since Jan 2007
Apr 11th, 2009
0

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

sir rm can u give me a simple sample on it? please? please please please?
Reputation Points: 3
Solved Threads: 5
Posting Whiz in Training
ryan311 is offline Offline
254 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Graphics and Multimedia Forum Timeline: Two tone background
Next Thread in Graphics and Multimedia Forum Timeline: Showing Enlarged Area of Image





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC