this line is what Im using to send the values:
<a class="btn btn-danger"href="remove_profesor.php? prof_id=<php echo $row['prof_id'];?> course_section=<php echo $row['course_section'] ;?>
Im trying to have button remove the assigned professor to the class. On the "view_courses.php" page theres a table with all the courses and theres a button next to each course that allows you to remove the professor that is assigned to that course. The button references "remove_professor.php". The issue im having is that "remove_professor.php" isnt recieving the second value which is "course_section".
This line is what im using to receive the values:
$prof_id = $_GET['prof_id'];
$course_section = $_GET['course_section'];
When I check the browser the values seems to be sending but then it gives me an error on the $course_section line, it says Undefined array key "course_section"
I think this code will help you
<?php
$prof_id = $row['prof_id']; // this value is coming from database as passing to variable
$course_section= $row['course_section']; // this value is coming from database as passing to variable
?>
<a class="btn btn-danger" href="remove_profesor.php?prof_id=<?php echo $prof_id?> &course_section=<?php echo $course_section?>">Click Here </a>
There is MULTIPLE issues with your a
tag.. This is the correction(s) -- I'll explain below..
<a class="btn btn-danger" href="remove_profesor.php?prof_id=<?php echo $row['prof_id'];?>&course_section=<?php echo $row['course_section'] ;?>">LINK</a>
your php
tags were invalid -- They need to be <?php
not <php
..
Your <a>
tag was incomplete.. No end quote and no end carat..
You need to something to LINK.. And have and end tag </a>
You had a space in the URL parameters.. No spaces..
Separate parameters with an ampersand &
To send multiple parameters with a GET, you have to separate them with &
, like this:
<a class="btn btn-danger" href="remove_profesor.php?prof_id=<?php echo $row['prof_id'];?>&course_section=<?php echo $row['course_section'];?">(link)</a>
It also seems that you write <php
instead of the correct <?php
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.