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
Did you know?Explore Trending and Topic pages for more stories like this.
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

Sessions work for me and not others?
I'm having a bit of bad luck with sessions. In the past they have worked fine for me, but this time

PHP - HTTP Digest Authentication - Understanding Code Help
Hi Everyone,

This is my first time on your website and please excuse if I am asking silly que

Sales orders ans reservations not taken into account on MPS / MRP
Hello,

I am implementing the MPS / MRP and I have the following problem:

I ha

Posting Serialized Data Not Working
I am trying to send an object from one PHP file to another using POST. I serialize the object and th

pageination not working right... coping images over 4 pages
Code: <?php //This code will obtain the required page number from the $_GET array. Note that

IIS on 2003 anon access disabled issue
I have an IIS server that belongs to a domain, and anonymous access is turned off for all my sites.

contact form - output to page and email
I have the following in my controller:

$message['name'] = htmlentities(strip_tags(trim($_POST

Add 5 to a variable when a button is clicked, and re-run a for loop
So I'm making a feedback sort of section on a website with MySQL and PHP, I've gotten the script to

Move array index to end
Hey guys,
Quick question:

I have an array that looks like this:
Code: [Select]$var =

Checking if variable is 0 as opposed to NULL/Empty...
I'm trying to write some code that will retrieve a user's access level from my database and if it do

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