Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Variable not recognized in PHP, CGI_IIS error?

Status
Not open for further replies.

smuckers

Programmer
Mar 5, 2002
31
US
Good Morning!

I am using code to call the php to update a file. While in the php file, a CGI error message appears saying that it does not recognize the variable. It provides a line number. The variable is the name of the object on the form. Here's the code.

Also, I am using IIS 5.0 with a standard PHP configuration. Do I need to change anything?

<form action=&quot;replace.php&quot; method=&quot;post&quot;>
<input type=&quot;text&quot; name=&quot;Text1&quot; >
<input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;submit&quot;>
</form

While in the replace.php file, I have tried several variations of the following line specified by the CGI error message:

print &quot;$Text1&quot;

No luck! I thought the php takes the name and assigns it as a variable name?

Thank you in advance for your help!

Smuckers



 
Your example does not end the line with a semicolon. Does your running code? ______________________________________________________________________
TANSTAAFL!
 
Good Morning sleipnir214!

Thank you for responding. Yes, the code has all the semicolons and print message works when I take out the dollar sign. With the dollar sign gone print &quot;Text1&quot; , the error message goes away and Text1 displays.

Thanks,

Smuckers
 
Are you getting an error, or no output.

The most common cause of problems with code like you've outlined is that the PHP runtime configuration directive &quot;register_globals&quot; is set to &quot;off&quot;.

Have you tried

print $_POST['Text1'];

or

print_r ($_POST);

______________________________________________________________________
TANSTAAFL!
 
Good Morning sleipnir214!

I will try those ideas. Yes, in big bold letters, CGI error is displayed, then it details which line of code was the culprit. Still, the error does go away when I take out the $ sign which does not help since I need the value of the variable.

Thank you again!

Smuckers
 
What is the exact text of the error message? ______________________________________________________________________
TANSTAAFL!
 
Good Afternoon sleipnir214!

I am nearly there. The Error codes have gone away, but the PHP variable is still not showing the text box value.

Here is the exact text for both files.

The first file name is E_FormTest.php:
<HTML>
<HEAD>
<TITLE>Form Input</TITLE>
</HEAD>
<BODY>

<H2>Welcome to the Web Site</H2>

<form action=&quot;E_processForm.php&quot; method=&quot;get&quot;>

Input value here:
<input type=&quot;text&quot; name=&quot;Username&quot;><br>

<input type=&quot;submit&quot; name=&quot;submit&quot;>

</form>
</BODY>
</HTML>

The E_processForm.php code is:

<HTML>
<HEAD>
<TITLE>Process Form Data </TITLE>
</HEAD>
<BODY>

<H3>Your info has been processed.</H3>

<?php
// The H3 header works but not this php.
print &quot;$Username&quot;;

?>

</BODY>
</HTML>

Thank you in advance for your help!

Smuckers
 
Good Afternoon:
This is my message:

Notice: Undefined variable: Username in C:\E_XML\PHPXML\E_processForm.php on line 13

Thanks,

Smuckers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top