Re: Undefined variable
| From: | Curtis Fisher | Date: | Sun, 15 Sep 2002 19:38:23 +0000 |
| Subject: | Re: Undefined variable | ||
| References: | 1 | Groups: | php.general php.windows |
| Request: | Send a blank email to php-general+get-116471@lists.php.net to get a copy of this message | ||
Try this instead
<!-- Server Side PHP Script here -->
<?php
//Check if passed variable exists
if (isset($_POST['topicName'] ) ) {
$topicName = $_POST['topicName'] ;
if ($topicName == "") $topicName = "Topic5.php";
} else {
$topicName = "Topic5.php";
}
if (isset($_POST['contentName'] ) ) { //if#1
$contentName = $_POST['contentName'] ;
if ($contentName == "") { //if#2
$contentName = "HomePage.php";
} else { //ifelse#2
//Check for multiple pages
include_once( "Includes/getCount.class");
$cntr = new fileCount;
$contentCount = $cntr->getCount("12");
//Check for logon page
if ($contentName == "content572.php") {
switch ($_POST['id'].$_POST['pw']) {
case "RenosRozstock":
$contentName = "Content573.php";
Break;
default:
$contentName = "LoginFailure.php";
} //End Switch
} //End If
} //endif#2
} else { //ifelse#1
$contentName = "HomePage.php";
} //endif#1
if (isset($_POST['contentTitle'] ) ) {
$contentTitle = $_POST['contentTitle'] ;
if ($contentTitle == "") $contentTitle = "No Title";
//echo "content title is being passed as ".$contentTitle;
} else {
$contentTitle = "";
}
?>
<!-- End Server Side PHP Script -->
"New B" <res04fg7@verizon.net> wrote in message
news:20020915111150.8166.qmail@pb1.pair.com...
> I am a beginner of PHP, and need help on PHP variable issue:
>
> I made an HTML form:
>
> ...
> <FORM ACTION="HandleForm.php" METHOD=POST>
> First Name <INPUT TYPE=TEXT NAME="FirstName" SIZE=20><BR>
> Last Name <INPUT TYPE=TEXT NAME="LastName" SIZE=40><BR>
> E-mail Address <INPUT TYPE=TEXT NAME="Email" SIZE=60><BR>
> Comments <TEXTAREA NAME="Comments" ROWS=5 COLS=40></TEXTAREA><BR>
> <INPUT TYPE=SUBMIT NAME=SUBMIT VALUE="Submit!">
> <INPUT TYPE=RESET NAME=RESET VALUE="Reset">
> </FORM>
> ...
>
> and I try to use a PHP page to retrieve data out:
>
> ...
> <BODY>
> <?php
> /* This page receives and handles the data generated by "form.html". */
> print "Your first name is $FirstName.<BR>\n";
> print "Your last name is $LastName.<BR>\n";
> print "Your E-mail addres is $Email.<BR>\n";
> print "This is what you had to say:<BR>\n $Comments<BR>\n";
> ?>
> </BODY>
> ...
>
> I end up getting error:
>
> Notice: Undefined variable: FirstName in \HandleForm.php on line 7
> Your first name is .
>
> Notice: Undefined variable: LastName in \HandleForm.php on line 8
> Your last name is .
>
> Notice: Undefined variable: Email in \HandleForm.php on line 9
> Your E-mail addres is .
>
> Notice: Undefined variable: Comments in \HandleForm.php on line 10
> This is what you had to say:
>
> Is it something wrong with my coding, IIS setup or PHP installation?
>
>