473,386 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

POST problems

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
4 1521
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: CJ Oxx | last post by:
Is there an easy way to transfer a page POST content to the next page? Right now I read out the POST content in the PHP script and put it in a html form (with POST as content type) as a hidden...
15
by: Håkan Persson | last post by:
Hi. I am trying to set up a simple HTTP-server but I have problems reading data that is beeing POSTed. class httpServer(BaseHTTPServer.BaseHTTPRequestHandler): def do_POST(self): input =...
2
by: Matt | last post by:
I want to post the form data (http://server/page1.asp) to a modal dialog window (http://server/modaldialog.asp) with a desired height 200px by width 200px. Here's my attempts and problems: ...
2
by: Matt | last post by:
I reposted this question because I really want to accomplish this task. Please advise!! I want to post the form data (http://server/page1.asp) to a modal dialog window...
3
by: Fredrik Kronander | last post by:
Hi, I have an application that let's the user enter text into a textbox and this data is collected on the server and stored in a database. The page is multilingual and sets Response.Charset to...
2
by: Matt | last post by:
When we submit the form data to another page, we usually do the following: <form action="display.aspx" method="post"> will submit the form data and open display.asp in the current browser ...
9
by: junlia | last post by:
Does anyone how how can we disable the auto-postback feature in asp.net page? I have to use a server side control in the page, but the auto post back feature in it causes problems for me. Please...
10
by: Danny | last post by:
Hi all, I am having some odd problems with AJAX on Firefox (1.5). When I use GET as the request method everything works ok, but when I do a POST the remote function doesn't get the parameters I...
3
by: JohnGos | last post by:
Since around 10th May (a couple of days after the recent IE autoupdate), a web application which has worked without problem for several years has developed intermittent problems with data posted from...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.