I've just started to learn php. I can't seem to get any data from an
HTML form to a php script. I've had a look at the manual and the various
on-line documentation and I think I'm doing things right but perhaps
someone can advice on the following :-

File: form.php


<form method="post" action="test.php" >
    Name: <input type="text" date="dateid"><br>
    <input type="submit">


File: test.php

<html><head><title>PHP Test</title></head>


echo "Hello World!<BR>";

foreach ($HTTP_POST_VARS as $var => $value) {
    echo "$var = $value<br>\n";

foreach ($HTTP_GET_VARS as $var => $value) {
    echo "$var = $value<br>\n";


echo "$dateid<BR>";

echo "Hello World!";




Hello World!
array(0) { }
Warning: Undefined variable: dateid in d:\Data\Web\test.php on line 19

Hello World!


Now I expect the warning for undefined dateid variable as this won't
work with register_globals enviornment variable set to off. But
according to the documentation the HTTP_POST_VARS should work. By the
way, I've tried using the GET method as well.

I'm running php 4.1.1, Apache 1.3.23 on NT4 SP6 using IE5.5 and Opera
6.0 Thinking it was my setup (which took a while to get working) I
uploaded the scripts to my ISP web server and got the same results!
(Linux, Apache 1.3.14, php 4.0.3pl1)

Any ideas as to what's happening ?

Also I'd like to display some times that are also hyperlinks such that
when clicked upon they call a php function passing in the time as
data/parameter. Can someone give me hints on the best way to do this. Do
these functions have to exist in a separate file, or can they reside in
the same file as the form/hyperlink data and just reference the function

Many thanks for your help.


Reply via email to