Results 1 to 2 of 2

Thread: Code in one order, appearance in other order

  1. #1
    Join Date
    Oct 2006
    Posts
    183
    Thanks
    0
    Thanked 11 Times in 11 Posts

    Default Code in one order, appearance in other order

    I have the script but I need the red parts to appear on bottom and the blue on top, but the code has to stay in that order...


    Code:
    <form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST" name="todo">
    <input type="hidden" name="ohash" value="<?php echo $hash ?>" />
    <pre>
    <input type="text" name="place" size="35" />
    <input type="text" name="data" size="35" />
    <input type="submit" name="submit" value="Add" />
    <input type="submit" name="submit" value="Remove" />
    <?php
    
        $data = file ( $file );
        $n = 0;
    
        foreach ( $data as $line ) {
    
            echo "<input type='checkbox' name='line[$n]' />" ;
    		echo "<a href=$place>$line</a>" ;
    
            $n++;
    
    	
        }
    
    ?>
    </pre>
    Now is there any way to make it so that even with the fields(red) on top, the data(blue) appears above it?

    It works right now but makes the fields at the top and I want them switched but the input "place" needs to stay at the top so it can retrieve the field's data in the href...


    if that makes any sense.

  2. #2
    Join Date
    Nov 2006
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by motormichael12 View Post
    I have the script but I need the red parts to appear on bottom and the blue on top, but the code has to stay in that order...


    Code:
    <form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST" name="todo">
    <input type="hidden" name="ohash" value="<?php echo $hash ?>" />
    
    
    
    <pre>
    <input type="text" name="place" size="35" />
    <input type="text" name="data" size="35" />
    <input type="submit" name="submit" value="Add" />
    <input type="submit" name="submit" value="Remove" />
    
    <?php
    
        $data = file ( $file );
        $n = 0;
    
        foreach ( $data as $line ) {
    
            echo "<input type='checkbox' name='line[$n]' />" ;
    		echo "<a href=$place>$line</a>" ;
    
            $n++;
    
    	
        }
    
    ?>
    
    </pre>

    Now is there any way to make it so that even with the fields(red) on top, the data(blue) appears above it?

    It works right now but makes the fields at the top and I want them switched but the input "place" needs to stay at the top so it can retrieve the field's data in the href...


    if that makes any sense.

    I'm assuming data from input is a filename..
    NEW CODE

    Code:
    <form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST" name="todo">
    <input type="hidden" name="ohash" value="<?php echo $hash ?>" />
    
    <?php
    if ($_POST["submit"] == "Add") {
        $data = file ( $file );
        $n = 0;
    
        foreach ( $data as $line ) {
    
            echo "<input type='checkbox' name='line[$n]' />" ;
    		echo "<a href=$place>$line</a>" ;
    
            $n++;
    
    	
        }
    }
    ?>
    
    <pre>
    <input type="text" name="place" size="35" />
    <input type="text" name="data" size="35" />
    <input type="submit" name="submit" value="Add" />
    <input type="submit" name="submit" value="Remove" />
    
    </pre>
    END NEW CODE

    Something like that ?

Bookmarks

Posting Permissions

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