PHP:Unable to post variables from html form to mysql database

From: sammmista (sammmista_at_gmail.com)
Date: 09/29/04


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>



Relevant Pages

  • Re: [PHP] accepting POST variables using CURL
    ... i have a HTML page when i submit the form i want ot read all teh POST ... There's the CLIENT which curl represents. ... You use curl to *send* POST data to the SERVER. ...
    (php.general)
  • Re: Best way to approach dynamically generated content from within an application hosting a webbrows
    ... The POST data is available in BeforeNavigate2. ... > after the question mark and use that to stream in the REAL HTML data? ... and I wish to display that content in an MSIE web ... >> "For every complex problem, there is a solution that is simple, neat, ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Re: How to do "Please wait ....."
    ... The best thing to do under this senario would be to post data ... in the server-side servlet/jsp output some html ... before diving into the long process. ...
    (comp.lang.java.help)
  • Re: How to do "Please wait ....."
    ... The best thing to do under this senario would be to post data ... in the server-side servlet/jsp output some html ... before diving into the long process. ...
    (comp.lang.java.programmer)