Page 1 of 1

browser doesnt recognize my php code

Posted: Thu May 28, 2009 8:00 pm
by montana111
im just starting out w/ php and have this page that i wanted to test:

Code: Select all

 
<html>
<head>
<title>chapter one, part two.  my short story</title>
</head>
 
<body>
 
<h3> My Short Story </h3>
 
<p>
 
Upon the half decayed veranda of a small frame house that stood near the edge of a NOUN near the town of PROPER NOUN, Ohio, a fat little old NOUN walked nervously up and down. Across a long field that had been PAST TENSE VERB for clover but that had produced only a dense crop of COLOR mustard NOUN, he could see the public PLACE along which went a wagon filled with berry pickers returning from the PLACE. FINISH THE STORY SENTENCE.
 
</p> 
 
<form method ="post"
    action ="yourStory.php">
 
    noun:
    <input type ="text"
        name ="noun1"
        value =""><br>
    proper noun:
    <input type ="text"
        name ="properNoun1"
        value =""><br>
    noun:
    <input type ="text"
        name ="noun2"
        value =""><br>
    past tense verb:
    <input type ="text"
        name ="PTVerb1"
        value =""><br>
    color:
    <input type ="text"
        name ="color1"
        value =""><br>
    noun:
    <input type ="text"
        name ="noun3"
        value =""><br>
    place:
    <input type ="text"
        name ="place1"
        value =""><br>
    place:
    <input type ="text"
        name ="place2"
        value =""><br>
    type the final sentence of the story here:
    <input type ="text area"
        name ="finalSentence"
        value =""><br>
    <input type ="submit"
        value ="Make story!">
 
</form>
 
</body>
 
</html>
 

::::::::::: this should connect with the following page/code :

Code: Select all

 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>chapter 1, part 2. final short story</title>
</head>
<body>
<h3>Your Final Story</h3>
<?
 
print <<<HERE
 
Upon the half decayed veranda of a small frame house that stood near the edge of a/an $noun1 near the town of $properNoun1, Ohio, a fat little old $noun2 walked nervously up and down. Across a long field that had been PTVerb1 for clover but that had produced only a dense crop of $color1 mustard $noun3, he could see the public $place1 along which went a wagon filled with berry pickers returning from the $place2. $finalSentence.
 
HERE;
 
?>
</body>
</html>
 
 
BUT, the output i get from my broswer is just "Your Final Story" and thats it. I have reg globals on cuz im just starting out so this should work as far as i know. can anyone tell me what is wrong?

Re: browser doesnt recognize my php code

Posted: Thu May 28, 2009 11:33 pm
by susrisha
may i suggest keeping the error_reporting on. this will out put errors if any occuring due to the execution.

Re: browser doesnt recognize my php code

Posted: Fri May 29, 2009 1:14 am
by montana111
thanks guys, ill try this all out. and thanks for the tips. i just had registar globals off cuz i have a book that starts you out that way and i wanted to follow it.

Re: browser doesnt recognize my php code

Posted: Fri May 29, 2009 4:32 pm
by califdon
In your second script, you need to define the variables, which I don't see that you did. You have to have lines like:

Code: Select all

$noun = $_POST['noun'];
You also don't need all those value="" attributes unless you want to supply default values.