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.

Recommended Answers

All 3 Replies

<?php if isset() //validate data entered howver you require
 { { define ('MYSQL_SERVER', 'MYSQLHOST');
 define ('MYSQL_DB', 'MYSQLDB');
 if (!(@mysql_pconnect(MYSQL_SERVER, MYSQL_USERNAME, MYSQL_PASSWORD) and @mysql_select_db(MYSQL_DB)))
 die(sprintf("Cannot connect to database, error: %s", mysql_error()));
if (!mysql_query(sprintf("insert into MYSQLDB_table
		(data1, data2, data3, data4, data5, ) values ('%s', '%s', '%s', '%s', '%s', '%s');", $data1, $data2,
$data3, $data4, $data5,)))
	{ echo "error adding your geoip entry to database!<br>";
	echo mysql_errno().": ".mysql_error()."<BR>";
	return false;
return true; }
<form action='<?php echo $_server['PHP_SELF']; ?>'>
<!-- input form -->

if u can post ur forum's html i can post back the whole php code for it :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.