943,807 Members | Top Members by Rank

Ad:
Jan 13th, 2009
0

Sending Form Fields to Database

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
SHAWTY721 is offline Offline
18 posts
since Jan 2008
Jan 14th, 2009
0

Re: Sending Form Fields to Database

php Syntax (Toggle Plain Text)
  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.
Reputation Points: 562
Solved Threads: 368
Posting Maven
almostbob is offline Offline
2,970 posts
since Jan 2009
Jan 16th, 2009
0

Re: Sending Form Fields to Database

if u can post ur forum's html i can post back the whole php code for it
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
wickedsunny is offline Offline
96 posts
since Oct 2008
Jan 21st, 2009
0

Re: Sending Form Fields to Database

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.
Reputation Points: 13
Solved Threads: 6
Junior Poster in Training
ccube921 is offline Offline
93 posts
since Oct 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 HTML and CSS Forum Timeline: static css footer at the bottom of windows
Next Thread in HTML and CSS Forum Timeline: css question





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


Follow us on Twitter


© 2011 DaniWeb® LLC