user3597305
user3597305

Reputation: 3

how to pass to diffrent information in href

i am trying to output some information based on the edit in the code below :

echo "<td>".$rows['td']."<a href='edittd.php?edit=$rows[Nom_Matiere]'> edit <a></td>";

but the problem is that i want to output this information using 2 different information $rows[Nom_Matiere] and $rows[Number] how can i do that i tried those options :

1*

echo "<td>".$rows['td']."<a href='edittd.php?edit=$rows[Nom_Matiere] and $rows[Number]'> edit <a></td>";

2*

  echo "<td>".$rows['td']."<a href='edittd.php?edit=$rows[Nom_Matiere] && $rows[Number]'> edit <a></td>";

but they didn't work ,please is there suggestions how i can do that ,and the edittd.php:

echo mysql_error();
if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['Mail_Enseignant']))
{echo mysql_error();
$username = $_SESSION['Mail_Enseignant'];      
    echo mysql_error();
//query the database
if(isset($_GET['edit'])){
        $Nom_Matiere = $_GET['edit'];
            $Number = $_GET['edit'];
        $res = mysql_query("select Nom_Etudiant,Numero from etudiant,groupe,matiere where matiere.`Nom_Matiere`= '".$Nom_Matiere."' and groupe.`Number`= '".$Number."' and matiere.`Id_Specialite`=groupe.`Id_Specialite`")or die($myQuery."<br/> <br/>".mysql_error());
while($rows = mysql_fetch_array($res)):

    echo "<tr class='light'>";
    echo "<td>".$rows['Nom_Etudiant']."</td>";  
    echo "<td>".$rows['Numero']."</td>";        
endwhile;}
            ?>

Upvotes: 0

Views: 41

Answers (2)

David Xu
David Xu

Reputation: 5597

To make two rows use:

  echo "<td>".$rows['td']."</td><td><a href='edittd.php?edit=$rows[Nom_Matiere]&amp; $rows[Number]'> edit <a></td>";

Changed: Added 2 tags instead of your one.

Also your code is full of SQL injection problems, use mysql_real_escape_string or better yet, use somethng better like PDO.

Upvotes: 0

Jessica
Jessica

Reputation: 7005

You need a parameter for the second value there.

 echo "<td>{$rows['td']}<a href='edittd.php?edit={$rows['Nom_Matiere']}&number={$rows['Number']}'> edit <a></td>";

Upvotes: 1

Related Questions