0

please take a look at my code,
what i want to happen is this,

1st, i want to pass the ID of the selected student from the other page, which can be updated or removed in the process...

which i can't , do it.. anyone can help me with this!

the problem where stated is in the CODE below. please help!

<?php
                    	include("connect.php");
						//config
						$per_page=5;
						//end config
						if(isset($_GET['start']))
						{
							$start=$_GET['start'];
						}
						else
						{
							$start=0;
						}	
					
						$record_count=mysql_num_rows(mysql_query("SELECT * from students"));
						
						
						$max_pages=$record_count / $per_page;
						$get=mysql_query("SELECT * from students LIMIT $start,$per_page");
						while($row=mysql_fetch_assoc($get))
						{
						$n=$row['idno'];
						$a=$row['section'];
						$y=$row['year'];
						$l=$row['lastname'];
						$f=$row['firstname'];
						$m=$row['middlename'];
						
 						echo '<td>'.$n.'</td>';
						echo '<td>'.$a.'</td>';
						echo '<td>'.$y.'</td>';
						echo '<td>'.$l.'</td>';
						echo '<td>'.$f.'</td>';
						echo '<td>'.$m.'</td>';

Starts here--->	echo '<td>';
i cant' pass the ID from another page --->

echo '<a href="up_student.php?up_student=<?php echo $row[id];?>"> edit</a>';
						echo '&nbsp;|&nbsp;';
		
						echo '<a href="up_student.php?up_student=                <?php echo $row[id];?>"> Remove</a>';
				---->		echo '</td>';
						echo '</tr>';
						echo '<tr>';
						
						}
                        
						$prev=$start-$per_page;
						$next=$start+$per_page;
						if(!($start<=0))
							echo "<a href='viewlist.php?start=$prev'>Prev</a>";
						$i=1;
						for($x=0;$x<$record_count;$x=$x+$per_page)
						{
							if($start!=$x)
								echo "<a href='viewlist.php?start=$x'>$i</a>";
							else
								echo "<a href='viewlist.php?start=$x'><b>$i</b></a>";
							$i++;
						}
						if(!($start>=$record_count-$per_page))
							echo "<a href='viewlist.php?start=$next'>Next</a>";				
						?>
                        </tr>
                        </table>
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by diafol
0

What do you want? the student ID value from a previous page? It depends how you're passing it.

In a url, use $_GET['id'] From a form use $_GET['id'] (default) or $_POST['id'] if you set the method to 'post'
You could also set it in a $_COOKIE or $_SESSION, depending on what you're using it for.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.