Welcome to Discuss Everything Forums...

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.


 

Tags for this Thread

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Bayoush
    Bayoush's Avatar
    Guest

    Please help on the below php code i get error on line 35?

    <HTML>
    <HEAD>
    <TITLE>Story Array Game</TITLE>
    </HEAD>
    <BODY>
    <font SIZE=4 COLOR="Red"> Story Array Game</font>
    <BR />
    <FONT SIZE=4 COLOR="Red">Please fill in the appropriate fields below: </FONT>



    <?php

    require('story_arrays.php'); // grabs the corresponding case from the story_arrays file

    $storyid = rand(1,3); // randomly generates a story in the $storyid array

    $storystructure = getStoryArray($storyid); // establishes which $storystructure array case to use

    ?>

    <FORM ACTION= "part3_story.php" METHOD=post> <!-- creates the form in order for the whole process to execute -->



    <table border="1" bgcolor="orange">

    <?php

    /* This script retrieves the corresponding story array.
    The conditional then prints the value. */

    foreach ($storystructure as $label) {
    echo "<tr><td>".$label."</td>";
    echo "<td><input type=text name=$label; ></td></tr>";
    }

    ?>
    </table>
    <input type=hidden name=storyid value="<?php echo $storyid; ?>" />
    <input type=submit name=submit value=submit />

    </FORM>
    <BR>

    </BODY>
    </HTML>

  2. #2
    AnonymousJohn's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Mar 2009
    Posts
    5
    Downloads
    0
    Uploads
    0
    It would be helpful to identify which line is causing problems.

    echo "<tr><td>".$label."</td>"; --> echo "<tr><td>" . $label . "</td>";

    try that for starters, i think that might be around 35.

  3. #3
    Chris G's Avatar
    Senior Member

    Status
    Offline
    Join Date
    May 2009
    Posts
    124
    Downloads
    0
    Uploads
    0
    This line:
    echo "<td><input type=text name=$label; ></td></tr>";

    is your problem. Change it to:

    echo '<td><input type="text" name="'.$label.'"></td></tr>';

    Attribute values should always be in quotations...

  4. #4
    blindmonkeyrecords
    blindmonkeyrecords's Avatar
    Guest
    The problem could be within the include file not the code shown.

    What is the error?

    I see a possible problem in the line
    echo "<td><input type=text name=$label; ></td></tr>";

    this should be
    echo "<td><input type=text name=".$label." ></td></tr>";

 

 

Quick Reply Quick Reply

Click here to log in


What comes after M0nday

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 03-08-2011, 04:42 AM
  2. Php help needed: Parse Error: Syntax error on line...?
    By killthesilencex in forum Discuss PHP
    Replies: 0
    Last Post: 10-04-2010, 05:05 PM
  3. Replies: 0
    Last Post: 05-03-2010, 10:05 PM
  4. Replies: 0
    Last Post: 05-20-2009, 12:55 PM
  5. Replies: 0
    Last Post: 04-21-2009, 09:41 PM

Bookmarks

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •