Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mising something..but where 2

Status
Not open for further replies.

Murugs

Technical User
Jun 24, 2002
549
US
My HTML

<input type="text" name="fullname"></p>
<form name="form1" method="post" action="basic.php" ENCTYPE="x- <p><input type="submit" value="submit" name="submit">
</form>

My PHP

<?
$conn=mysql_connect("localhost", "root", "root");
mysql_select_db("sama",$conn);

$a1 = $_POST['fullname'];
echo $a1;

if ($_POST['submit'] == "submit")
{
$query = "INSERT INTO test values ('$a1')"; mysql_query($query);
}
?>

sama is by db and test is my table.
For some reason I am not able to echo the value of a1.

Upon pressing submit the db is populated but with no contents i.e the name is blank.

I am breaking my head for this simple problem.
Please help

regards
MP
 
$a1 gets it's value from $_POST['fullname']. $_POST['fullname'] will get its value from a form field named "fullname". The HTML form you've listed does not have a form field named "fullname".

There is a field name "fullname" on the page, but it appears outside of the <form...>...</form> tags, so its value will not be submitted then the form is submitted.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Murugs,

It looks like you have these two lines

[red]<input type="text" name="fullname"></p>
<form name="form1" method="post" action="basic.php" ENCTYPE="x-www-form-urlencoded">[/red]

reversed.

Wishdiak
 
thanks guys....so simple.
really feel for this dumb post..sorry guys.

regards
MP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top