The way you are passing variables from processform.php to name.php (name.php?applicant=applicantname), name.php will recieve the variable as $_GET['applicant'], not $_POST['applicant']. For more information, see http://us3.php.net/manual/en/language.variables.predefined.php

Allan Cooper wrote:
Hi all

My setup is thus:

Installed on WinXP (SP1) Web-Server SuiteVersion 1.14 standard, auto-setup which includes the following:
PHP 4.3.10
Apache 2
MySQL
PhpMyAdmin
and Perl (But I dont intend to use it just yet, thats a problem for another day lol)

I believe PHP is setup as a module in Apache as opposed to a cgi-bin install. Well thats what it says anyways.

Setup went well and all elements appeared to work fine, until.....
Now excuse the rudimentary nature of the scripts.
The code samples that follow were taken from Professional PHP Programming by Wrox Press. ISBN 1-861002-96-3
It was written when PHP4 was just starting, so some conventions are changed. (see comments below)
See  http://www.wrox.com for more info.
Comments are for my benefit, but I left them in to make it simpler for all.
----------------------
<html>
<!-- jobapp.html -->
<!--  generates a form to send info to processform.php -->
<head>  </head>
   <body>
       <h1>Phop's Bicycle Shop Job Application</h1>
       <p>Are you looking for an exciting career in the world of cyclery?<br>
       <p>Look no further!</p>
           <form name='frmjobapp' method=post action="">
               Please enter your name here:
               <input type=text name="applicant"><br>
               <input name="enter" type=submit value="ENTER"><br>
           </form>
   </body>
</html>



---------------------
<html>
<!-- processform.php -->
<head>   </head>
   <body>
       <p>Welcome, <?php echo  ($_POST["applicant"]); ?>!</p>  <!-- note that you need to use
                                                                                                       ($_POST["applicant"])
                                                                                                       instead of the depricated ($applicant)
                                                                                                        in PHP Programming on p72
                                                                                                       a directive in php.ini demands it -->
       <br><br>
       <a target="_new" href=""applicant"])); ?>"> Show Name</a>
   </body>
</html>
---------------------  <html>
<!-- name.php -->
<head>   </head>
   <body>
       <p>Welcome, <?php echo  ($_POST["applicant"]); ?>!</p>  <!-- supposed to be parsed the name/value pair
                                                                                                            from processform.php
                                                                                                            note that need to use
                                                                                                            ($_POST["applicant"])
                                                                                                            instead of the depricated ($applicant)
                                                                                                            in PHP Programming on p76
                                                                                                            a directive in php.ini demands it -->
   </body>
</html>



----------------------
My problem is thus:

In name.php, it is supposed to be passed the name/value pair from processform.php
This does not happen, although it works from jobapp.html to processform.php
This has to be a simple problem as the initial name/value pair worked correctly.
Can anyone please tell me whats going on?

Any further info/configuration files needed, please just say and ill supply it.

Regards
Allan



Reply via email to