passing variable do not display value in PHP

Discussion of programming on Linux, including shell scripting, perl, python, c/c++, mono, java. Whatever tickles your fancy.
Posts: 125
Joined: Sun Jan 26, 2003 4:54 pm

passing variable do not display value in PHP

Postby mohdali2 » Thu Aug 19, 2004 3:30 am

I am using PHP 4 with Apache 2. I have a very misterious

I make a file with the name of job_simple.html the code is
as follows:

<!-- jobapp_simple.html -->
<H1>Phop's Bicycles Job Application</H1>
<P>Are you looking for an exciting career in the world of cyclery?
Look no further!

<FORM NAME='frmjobapp' METHOD=post ACTION="/phppractice/jobapp_simple_action.php">
Please enter your name:
<INPUT NAME="applicant" type="text"><BR>
<INPUT NAME="enter" TYPE="submit" VALUE="Enter">

Now when I enter any string in the name field and press enter
jobapp_simple_action.php prints only Welcome the $applicant
value does not show by browser. The code of
jobapp_simple_action.php is as follows:

<!-- jobapp_simple_action.php -->
<P>Welcome <?php echo ($applicant); ?></p>

Anyone knows please help me, thanks in advance.

Muhammad Ali

Site Admin
Posts: 918
Joined: Wed Aug 07, 2002 8:00 pm
Location: Addison, IL

Postby fawad » Thu Aug 19, 2004 9:09 am

The thing is that the newer PHP installs set register_global to false. That means that $applicant isnt set in the target page. To get the value of the variable, use
instead of

You could set register_global to true, but I really wouldn't recommend it unless you're inheriting a huge codebase with constructs like you mentioned.

Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest