insert form data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello list,

I am able to get the query to work by itself but it will not work using
the if (isset ($submit)) and NO errors are outputting...nothing.  

Any suggestions would be greatly appreciated.  I havnt even gotten to
the form variables yet...and yes, my globals are turned on (at least for
now).  Are there error display holes that I have missed?

What am I doing wrong ???...

Here's code:


<?
if (isset ($submit) ) 
{

	function showerror()
	{
		die("Error " . mysql_errno() . " : " . mysql_error());
	}
	
	$dbhost = "1.1.1.1";
	$dbuname = "uname";
	$dbpass = "password";
	$dbname = "databasename";
	
	$link = mysql_connect ($dbhost, $dbuname, $dbpass) or die ("Unable to
connect");
	@mysql_select_db("$dbname") or die ("Unable to select database");
	
	
	//From other script - this query works but not on this page.	
	$query = "INSERT INTO `cust_info` (  `comp_name` , `city` , `state` )
VALUES ('test3', 'test3', 'test3');";
		
	if (!mysql_query ($query, $link ))
	showerror();//nothing
	echo "Here's query: $query";//nothing
}
else
{
	
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<title></title></head>
<body>
<center>
<h3>Welcome to<br>Toshiba International Corporation<br>Customer
Feedback</center>
<form name="form1" action="survey_index.php" method="post">
<table align="center" cellpadding="5">
<tr>
<th colspan="2">Please Enter the Information Below and Press the
'Submit' <br>Button When Finished.<br>(All Fields
Required)</th><tr><td>&nbsp;</td></tr></tr><tr>
<td><b> Company Name:  </b></td>
<td><input type="text" name="comp_name" size="50"></td></tr>
<tr><td><b>City:</b></td>
<td><input type="text" name="city" size="50"></td>
</tr>
<tr><td><b>State:</b></td><td>
<select name="state" size="1">
		<option value=""../>Choose one
		<option value=al>AL
                <option value=ak>AK
                </select>
</td></tr>
<tr><td><b>Contact Name:  </b></td>
<td><input type="text" name="contact" size="50"></td></tr>
</table>
<br>
<table align="center">
<tr ><td>
<center>
<input type="submit" value="Submit">
</center>
</form>
</table>
</body>
</html>
<?
}
?>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux