By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,955 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,955 IT Pros & Developers. It's quick & easy.

POST problems

P: n/a
Ant
Howdy,

I'm creating a register form which passes some user values to my php file
using POST

here's the code:

form name="register" method="post" action="register.php">
<tr>
<td>User Name:</td>
<td><input name="user_id" type="text" value="" size="20"/> </td>
</tr>

in my php file I'm trying to get the value of user_id by doing this:

$user_id = $_POST["user_id"];

but when I echo $user_id nothing appears so I guess the value isn't be
passed as I woud expect.

I'm sur eI'm making a very elementary mistake but I just cannot figure out
what's wrong?

Any help much appreciated.

Thanks


Oct 27 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Try the following as a test:

<?php

echo $_POST['var'];

?>
<form name="form" method="post" action="<?php echo $PHP_SELF; ?>">
<input name="var" type="text" id="var">
<input type="submit" name="Submit" value="Submit">
</form>
Your example didn't give any problems here btw.

Frizzle.

Oct 27 '05 #2

P: n/a
Ant
"frizzle" <ph********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Try the following as a test:
Your example didn't give any problems here btw.

Frizzle.


Thanks for the reply.

I did that and got the same error message as with my earlier posted code.
Oct 27 '05 #3

P: n/a
Ant
"frizzle" <ph********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Try the following as a test:

Your example didn't give any problems here btw.

Frizzle.


Thanks for the reply. I tried out your code and got the same error message
as with my code posted earlier - Undefined index: var in C:\webdev\test.php
on line 3 - so I guess my php must be broken somehow!! or maybe it's apache
but it all seems to be working fine. It's been a while since I've worked
with php and I don't remember altering its settings or anything.

This is very odd indeed!

I tested phpinfo() to check and that worked - im using version 5.0.4

I'm confused as to how I can solve this problem.
Oct 27 '05 #4

P: n/a
Ant said the following on 27/10/2005 18:23:
Howdy,

I'm creating a register form which passes some user values to my php file
using POST

here's the code:

form name="register" method="post" action="register.php">
<tr>
<td>User Name:</td>
<td><input name="user_id" type="text" value="" size="20"/> </td>
</tr>

I assume that in reality, your HTML isn't this screwed up?
$user_id = $_POST["user_id"];

but when I echo $user_id nothing appears so I guess the value isn't be
passed as I woud expect.


What version of PHP are you using? Older than PHP 4.1.0, you need to use
$HTTP_POST_VARS.

--
Oli
Oct 27 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.