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
19
Other forums
need help in mysql_num_rows()
please tell me what i am doing wrong in this query. it displays this error
Code: Warning: mys
Move array index to end
Hey guys,
Quick question:
I have an array that looks like this:
Code: [Select]$var =
isset undefined variable
Hi all,
Hope someone can point out the obvious. I've a log in script, if you dont enter a use
re calling a function without including file
Hi,
i am new to programming in php, i was just checking the wordpress code and found out in the w
RTF fomatting to email content
Im trying to sen an email with content is picked up from a rtf-file (file_get_contents('*.rtf'). Mai
Structure Question - One Table or One Table Per Record Set?
I have a web app (mySQL and PHP) which allows people to create an item with up to 200 records which
Must-Know Topics of PHP
Can you guys list the must-know topics of PHP. I am still a learner and I am trying to cover most of
problem when runing a funciton
I am trying to connect to database using a funciton in a functions.php
<?php
funct
displaying unknown amount of results
I am reading a directory and getting a list of folders in the directory, I want to display the folde
Creating a custom API
I'm creating a site, and I need to create a basic API. Unfortunately I have no idea where to start.