Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder GO ILLINI's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    634
    Thanks
    0
    Thanked 7 Times in 7 Posts

    something wrong with loop

    Code:
    Parse error:  parse error, unexpected '\"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\server\xampp\htdocs\cfg\adverts.php on line 20
    PHP Code:
       $i 0;
       while(
    $i $line_num) {
          
    echo 
    "$_POST[" . $i . "]";
          
          
        $i++;
       } 
    I dont see anything wrong with that. The form I am almost certian is all right but here it is too

    PHP Code:
    <form action='adverts.php?action=edit' method='post'>
    <p>
    Edit current adverts:<br>
    <table>
    <?php
    $lines 
    file("$cstrike\cfg\mani_admin_plugin\adverts.txt");
    foreach (
    $lines as $line_num => $line) {
       echo 
    "<tr><td>$line</td>\n";
       echo 
    "<td><input type='text' value='$line' name='$line_num'></td></tr>\n";
    }
    ?>
    <input type='hidden' name='lines' value=<?php echo($line_num); ?>>
    <tr><td colspan='2'><center><input type='submit' value='Submit Changes'></center></td></tr>
    </table>
    </p>
    </form>
    The form returns everything exactly as it should be.
    Output of form:
    Code:
    <form action='adverts.php?action=edit' method='post'>
    <p>
    Edit current adverts:<br>
    <table>
    <tr><td>{RED}http://www.mani-admin-plugin.com
    </td>
    <td><input type='text' value='{RED}http://www.mani-admin-plugin.com
    ' name='0'></td></tr>
    <tr><td>{GREEN}Current map is {CURRENTMAP}
    </td>
    <td><input type='text' value='{GREEN}Current map is {CURRENTMAP}
    ' name='1'></td></tr>
    <tr><td>{BLUE}Mani Admin Plugin
    </td>
    <td><input type='text' value='{BLUE}Mani Admin Plugin
    ' name='2'></td></tr>
    <tr><td>Next map is {NEXTMAP}
    </td>
    <td><input type='text' value='Next map is {NEXTMAP}
    ' name='3'></td></tr>
    <tr><td>{WHITE}Server Tick Rate {TICKRATE}
    </td>
    <td><input type='text' value='{WHITE}Server Tick Rate {TICKRATE}
    ' name='4'></td></tr>
    <tr><td>hgsdg
    </td>
    <td><input type='text' value='hgsdg
    ' name='5'></td></tr>
    <tr><td>adam</td>
    <td><input type='text' value='adam' name='6'></td></tr>
    <input type='hidden' name='lines' value=6>
    <tr><td colspan='2'><center><input type='submit' value='Submit Changes'></center></td></tr>
    </table>
    </p>
    </form>
    Anybody help please? Sorry about all the code, but people ask for it and I didnt wanna leave anything out.

    The one and only,
    ILLINI
    Why not thank me?

    http://adamsworld.name

  • #2
    Regular Coder
    Join Date
    Sep 2005
    Posts
    394
    Thanks
    1
    Thanked 0 Times in 0 Posts
    echo "$_POST[" . $i . "]"; is wrong. Should be echo $_POST[$i];

    ~Phil~

  • #3
    Regular Coder GO ILLINI's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    634
    Thanks
    0
    Thanked 7 Times in 7 Posts
    No errors now, but there is nothing there...


    The one and only,
    ILLINI
    Why not thank me?

    http://adamsworld.name

  • #4
    Regular Coder GO ILLINI's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    634
    Thanks
    0
    Thanked 7 Times in 7 Posts
    It is because of the loop. Nothing echos from inside it.
    I tried echoing the post vars outside of the loop, and they showed up fine.
    any help?


    The one and only,
    ILLINI
    Why not thank me?

    http://adamsworld.name


  •  

    Posting Permissions

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