Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
September 29, 2004, 5:23 pm
rate this thread
Plz dont treat this as another newbie query , i did my homework but
still getting nowhere :( :( :(
Trying to learn PHP on Fedora core 1 (PHP 4.3,MySQL,HTTPD).Unable to
post data from html form to php file(connecting to mysql database and
inserting into a table) .
This seemingly simple problem is making me go mad !!! I googled
extensively and already tried the following
I enabled " register_globals = On " .... in /etc/php.ini and
also took used _$POST syntax.
wot could be the problem .... is it the case that /etc/php.ini file is
not being read .... how do i know whether this is the default location
Where can i find the PHPRC environment variable (the variable
responsible for the php.ini default location)
Is the problem something else .....?
Plz help me out experts!!!!
Following is the code ...
<TITLE> email entry form </TITLE>
<P>plz fil the form </P>
<FORM METHOD="POST" ACTON="form-handler.php">
<INPUT TYPE=TEXT NAME="givename" SIZE=25> <BR>
<INPUT TYPE=TEXT NAME="givenaddress" SIZE=25> <BR>
<TITLE> EMAIL FORM HANDLER </TITLE>
mysql_connect("localhost","root") or die("Failure on db connection");
//$query = " insert into sample(name,address)
$query = " INSERT INTO sample SET
name = '_$POST[givename]',
address = '_$POST[givenaddress]' ";
$result = mysql_query($query) or die("Unable to record your info");
print("your info has been recorded");
- Stefan Hegenbart
September 30, 2004, 3:08 am
it is NOT _$POST but $_POST!
to check if your ini is used try the command phpinfo(); you can see your
settings then - if you change something it should be there too.
try to turn error reporting on when developing scripts. do this by
starting your script with something like
that might put out a lot of notices too but helps writing clean code.
to find out where php looks for his ini just turn to the manual. i
prefer using the directive in the apache httpd.conf
"The goal of Computer Science is to build something that will last at
least until we've finished building it." -- unknown
Re: PHP:Unable to post variables from html form to mysql database
Famous last words: "I don't know how to deactivate this time bomb. I
better press every button I see."
<?php phpinfo(); ?>
Somewhere in the source code.
Yes, it is.
"ACTON" should be "action".
You don't want to start this block with "<?". Use "<?php".
Look up the syntax for INSERT and use $_POST instead of _$POST. If you
go to your php.ini and set your error_reporting to E_ALL, you might be
able to find some of those errors by yourself.
Not very friendly, eh? Have a look at mysql_error().