Sending Form Fields to Database

Reply

Join Date: Jan 2008
Posts: 16
Reputation: SHAWTY721 is an unknown quantity at this point 
Solved Threads: 0
SHAWTY721 SHAWTY721 is offline Offline
Newbie Poster

Sending Form Fields to Database

 
0
  #1
Jan 13th, 2009
I created a form using Dreamweaver and am trying to figure out how to get the form contents saved to a database. Does anyone know of a way to to do this.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,350
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 163
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: Sending Form Fields to Database

 
0
  #2
Jan 14th, 2009
  1. <?php if isset() //validate data entered howver you require
  2. { { define ('MYSQL_SERVER', 'MYSQLHOST');
  3. define ('MYSQL_PASSWORD', 'MYSQLPASS' );
  4. define ('MYSQL_USERNAME', 'MYSQLUSER');
  5. define ('MYSQL_DB', 'MYSQLDB');
  6. if (!(@mysql_pconnect(MYSQL_SERVER, MYSQL_USERNAME, MYSQL_PASSWORD) and @mysql_select_db(MYSQL_DB)))
  7. die(sprintf("Cannot connect to database, error: %s", mysql_error()));
  8. }
  9. if (!mysql_query(sprintf("insert into MYSQLDB_table
  10. (data1, data2, data3, data4, data5, ) values ('%s', '%s', '%s', '%s', '%s', '%s');", $data1, $data2,
  11. $data3, $data4, $data5,)))
  12. { echo "error adding your geoip entry to database!<br>";
  13. echo mysql_errno().": ".mysql_error()."<BR>";
  14. return false;
  15. }
  16. return true; }
  17. ?>
  18. <form action='<?php echo $_server['PHP_SELF']; ?>'>
  19. <!-- input form -->
Last edited by almostbob; Jan 14th, 2009 at 5:18 pm.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 89
Reputation: wickedsunny is an unknown quantity at this point 
Solved Threads: 4
wickedsunny wickedsunny is offline Offline
Junior Poster in Training

Re: Sending Form Fields to Database

 
0
  #3
Jan 16th, 2009
if u can post ur forum's html i can post back the whole php code for it
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 76
Reputation: ccube921 is an unknown quantity at this point 
Solved Threads: 6
ccube921 ccube921 is offline Offline
Junior Poster in Training

Re: Sending Form Fields to Database

 
0
  #4
Jan 21st, 2009
This, by the way is called php, if your interested in this, you might want to check these two links:
http://w3schools.com/php/default.asp
http://hudzilla.org/phpwiki/index.php?title=Main_Page

The first one is universal, a goiod site for web tutorials of any kind.
The second is a great tutorial (which I am in the middle of myself)
you should look at both really.
If I have been helpful add to my reputation!
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