Forum Moderators: coopster
<?php
/* Start of PHP3 Script */
/* Data of SQL-server */
$server="server";/* Address of database server*/
$user="user"; /* Database username */
$password="password"; /* Database Password*/
$database="database"; /* name of database */
$table="Test"; /* Name of table, you can select that */
$county=$_POST['county'];
$township=$_POST['township'];
/* Accessing SQL-server */
MYSQL_CONNECT($server, $user, $password) or die ( "<H3>Server unreachable</H3>");
MYSQL_SELECT_DB($database) or die ( "<H3>Database non existent</H3>");
/* Entering the values */
$sql="select * from Test where County = ".$_POST
['county']. " and Township = ".$_POST['township'].
"";
echo $sql;
$query = "insert INTO $table (county, township) VALUES ('$county', '$township')";
mysql_query($query);
?>
Try that instead, that is one of the problems...you leaving out alot of code..is that on purpose?
After looking at it more, what are you using a SELECT statement? If you only need to INSERT $_POST["county"] and $_POST["township"] into the database forget the SELECT statement and just use
"INSERT INTO Test SET County = '$_POST[county]', Township = '$_POST[township]'"
In reference to the select statement, I believe you are correct, I will try you suggestion and see if that works as well.
I do have one question, in other forums I have read that you do not have to use the $Post command if the register_globals are turned on, is this correct?