Wrong Info sent Using $get in form


Posted on 16th Feb 2014 07:03 pm by admin

Hi i have this code that i tried to make to send some info from one page to aother with lots of ppls help and it works ok but when i have multiple files it doesnt send the correct info.
What im tryin to get is the Num_Pages to another page it works fine if its just one file in the db but when its multiple and i select a file in the middle of the table or somewhere else i dont get tht info i get the last file info.
Can anyone help if I didnt confuse u?
Thank You
Code: <?php
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$sql = "SELECT * FROM files where username = '".$_SESSION['myusername']."' ORDER BY id ASC ";
//$sql = "ORDER BY id ASC";
$result = mysql_query($sql);
$rows = mysql_num_rows($result);


echo "<form method='POST' action='count.php'><table border='2px'>n";
echo " <tr>n";
echo " <td align='center'>Date Added</td>n";
echo " <td align='center'>Files</td>n";
echo " <td align='center'>Number of Pages</td>n";
echo " <td align='center'>Prepare To Print</td>n";
echo " <td> </td>n";
echo " </tr>n";

for ($i = 0; $i < $rows; $i++) {
$data = mysql_fetch_object($result);
// since our script is very small, i'm not going to escape out to html mode here
echo " <tr>n";
echo " <td>$data->Date</td>n";
echo " <td>$data->File_Name</td>n";
echo " <td align='center'><input name='pages' type='hidden' value='$data->Num_Pages'>$data->Num_Pages</td>n";
echo " <td align='center'>
<input type='submit' value='Edit' name='editbutton'></form></td>";
echo " </tr>n";
}

?>

No comments posted yet

Your Answer:

Login to answer
325 Like 19 Dislike
Previous forums Next forums
Other forums

text box alphanumeric caracters only
hi all!

I have search on google on how to enter in a test box only caracters A-Z,a-z,0-9 usi

user administration
Dear @all,

what I have to do to set the user defaults for new users. At the moment I woul

pagination - need help on passing of search query.
Hi, i have been trying for days but couldn't get this sorted out. Would like some professional help

help removing unwanted graphic
How do I remove the small elongated rectangular shape between the "Latest post" and "

Match stored value with the current value in a loop
Hello,

I have a MySQL db were I store articles in.

I have a form to fill these article

Points for Wiki contribution
Hi everyone,

I want to know how long does it take for the moderator to award points for a

PHP Script runs on CLI but not through web browser
I am running into an issue that I just can't seem to find the answer to. I have a Windows Server 200

unexpected T_STRING
error log "[Sat Jan 09 18:27:58 2010] [error] [client 127.0.0.1] PHP Parse error: syntax error

check how many commas the variable containing the query has between [i]select[/i
Hi...

iv made an sql table that contains id number - name of sql query and an sql query.
T

IP Based Cron Jobs
I run cronjobs on my website. After one of my visitors got curious and tinkered around he realized h

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash