0

I have this code in php

while($row = mysqli_fetch_array($result)) {
?>
<tr>
<td><?php echo $row["Sec_No"]; ?></td>
<td><?php echo $row["Sec_Sub"]; ?></td>
<td><?php echo $row["Sec_Lec"]; ?></td>
<td><a href="Theo_Entery_Sheet.php?Sec_No=<?php echo $row["Sec_No"]; ?>"> ُEnter Marks/>a></td> 
</tr>
<?php

I want to pass the field [Sec_Sub] beside the field [Sec_No] that is exist in href statment as query string to another page (Theo_Entery_Sheet.php)


Theo_Entery_Sheet.php i want the part of SQL "WHERE" take two conditions Sec_No AND Sec_Sub that is comming from above page

... ... ...

$sql = "SELECT theo_stu_sections.Sec_No, theo_stu_sections.St_No, students.Name, theo_stu_sections.Mid, 
. "FROM students INNER JOIN theo_stu_sections ON students.St_ID = theo_stu_sections.St_No\n"
. "WHERE Sec_No='".$_GET['Sec_No']."'\n"
. "ORDER BY students.Name;";

thank You

I want the page to receive two parameters from the page which send query string

sami
  • 9
  • 1
  • So what exactly is the problem then? It's easy to pass multiple parameters in a URL - just separate them with `&`. E.g. `example.php?param1=value1&param2=value2`. It's unclear whether you know this or not, or what you've researched or tried so far, or where/why you're stuck. – ADyson Nov 05 '22 at 22:03
  • Reference: https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_is_a_URL#parameters – ADyson Nov 05 '22 at 22:05
  • 1
    P.s. your sql query is vulnerable to sql injection attacks. Please urgently start using prepared statements and parameters to include outside data safely into your queries. See also https://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php for more details and solutions – ADyson Nov 05 '22 at 22:07

0 Answers0