PHP:Unable to post variables from html form to mysql database
From: sammmista (sammmista_at_gmail.com)
Date: 09/29/04
- Next message: Alvaro G. Vicario: "Re: how does one normally search for text in a database that might have slashes applied to quotes?"
- Previous message: Piotr: "Re: splitting merged words but www adresses (regexp)"
- Next in thread: jf: "Re: PHP:Unable to post variables from html form to mysql database"
- Reply: jf: "Re: PHP:Unable to post variables from html form to mysql database"
- Reply: Stefan Hegenbart: "syntax error"
- Reply: Matthias Esken: "Re: PHP:Unable to post variables from html form to mysql database"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Sep 2004 12:23:12 -0700
hello experts,
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
for php.ini?
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!!!!
Thx Adv
Regards,
Sammista.
Following is the code ...
form.html
---------
<HTML>
<HEAD>
<TITLE> email entry form </TITLE>
</HEAD>
<BODY>
<P>plz fil the form </P>
<FORM METHOD="POST" ACTON="form-handler.php">
NAME: <BR>
<INPUT TYPE=TEXT NAME="givename" SIZE=25> <BR>
AGE: <br>
<INPUT TYPE=TEXT NAME="givenaddress" SIZE=25> <BR>
<INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>
form-handler.php
-----------------
<HTML>
<HEAD>
<TITLE> EMAIL FORM HANDLER </TITLE>
</HEAD>
<BODY>
<?
mysql_connect("localhost","root") or die("Failure on db connection");
mysql_select_db("mydb");
//$query = " insert into sample(name,address)
values(_$POST['givename'],_$POST['givenaddress'])";
$query = " INSERT INTO sample SET
name = '_$POST[givename]',
address = '_$POST[givenaddress]' ";
$result = mysql_query($query) or die("Unable to record your info");
print("result:$result");
print("your info has been recorded");
?>
</body>
</html>
- Next message: Alvaro G. Vicario: "Re: how does one normally search for text in a database that might have slashes applied to quotes?"
- Previous message: Piotr: "Re: splitting merged words but www adresses (regexp)"
- Next in thread: jf: "Re: PHP:Unable to post variables from html form to mysql database"
- Reply: jf: "Re: PHP:Unable to post variables from html form to mysql database"
- Reply: Stefan Hegenbart: "syntax error"
- Reply: Matthias Esken: "Re: PHP:Unable to post variables from html form to mysql database"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|