Log in

View Full Version : Code in one order, appearance in other order



motormichael12
11-10-2006, 06:37 PM
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...



<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.

Acey99
11-13-2006, 06:44 PM
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...



<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


<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 ?