Hello all,
I've been looking at this code for ages now and can't seem to work out what is wrong. I keep getting the following message "Notice: Undefined index: name1 in C:\Program Files\EasyPHP 3.0\www\formtest.php on line 16"
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form method="post" action="http://localhost/page2.php?img_id=17647.jpg">
Input1: <input type="text" name="name1" id="ins1"><br />
Input2: <input type="text" name="name2" id="ins2"><br />
Input3: <input type="text" name="name3" id="ins3"><br />
<input type="submit" value="submit">
</form>
<?php
$textfieldcontent1 = $_POST['name1'];
?>
</body>
</html>
Can anyone help me figure out why I'm getting this message?
Thanks in advance!
bubs81
[RESOLVED] using $_POST
Moderator: General Moderators
[RESOLVED] using $_POST
Last edited by bubs81 on Thu Jan 15, 2009 7:54 am, edited 1 time in total.
Re: using $_POST
1. You cannot use the post variable in the same page. It has to be posted from some other page
2. Try using the same code in your page2.php
And here is a solution for the piece of code you wrote
try it out and tell me if its fixed
2. Try using the same code in your page2.php
And here is a solution for the piece of code you wrote
Code: Select all
//check if there is a variable "name1" in the post variables and then assign
if(isset($_POST['name1']))
{
$textfield1=$_POST['name1'];
}
//should be able to work
Re: using $_POST
That works great - thank you!!!! 