Hello,
What I am doing is very simple. I have a form in register.php with several
textboxes and stuff.
On submit, the doRegister.php file is invoked. Now, in that file, I am not
able to successfully retrieve
the parameters filled in the forms (which I need to use to run a db query.)
I checked all syntax and everything seems just as expected in PHP. I tried
both GET and POST.
WHile using GET I can see the parameters in the URL. I am running PHP4 via
Apache 2.0.43.
Can somebody tell me what
could be going wrong?
Thanks,
Ash
Here are the files
register.php
<form method="post" action="../controller/doRegister.php"
name="register">
<table width="100%" border="0">
<tr>
<td> First Name
<input type="text" name="firstName" size="30" maxlength="30">
</td>
<td> Last Name
<input type="text" name="lastName" size="30" maxlength="30">
</td>
</tr>
<!-- SNIP -->
<tr>
<td colspan="2">
<div align="center">
<input type="submit" name="register" value="Register">
</div>
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table>
</form>
doRegister.php
----------------------
<?php
echo "adding 1 [" . $firstName . "]<br>";
include("../common/opendb.php");
addStuff('ssn03', $firstName, $lastName, $addess1, $address2, $city, $state,
$zip, '123456789', $email, $password);
//header("Location: ../general/home.php");
exit();
function addStuff($SSN, $firstName, $lastName, $address1, $address2, $city,
$state, $zip, $phone, $email, $password)
{
include("../common/queryList.php");
echo "adding tip 2 ";
echo "[" . $firstName . "]<br>";
$query = "INSERT INTO Receiver VALUES ($SSN, $firstName, $lastName,
$address1, $address2, $city, $state, $zip, $phone, $email, NULL)";
echo "query: " . $query . "\n<br>";
$result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());
echo $result;
// close database connection
//mysql_close($connection);
// get and print number of rows in resultset
//return mysql_num_rows($result);
//echo "\n[" . mysql_num_rows($result) . " rows returned]\n";
}
?>
Here is the output I get
------------------------------------
adding tip receiver 1 []
adding tip receiver 2 []
query: INSERT INTO Receiver VALUES (ssn03, , , , , , , , 123456789, , NULL)
Error in query: INSERT INTO Receiver VALUES (ssn03, , , , , , , , 123456789,
, ash, NULL). You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use near '
, , , , , , 123456789, , NULL)' at line 1
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php