Reputation: 1
I have a problem using a "header location", below is the code:
case 'update':
updateUser($_GET['ticket_id']);
header('Location: ../ticket/listOfTicket.php?ticket_id='.$_GET['ticket_id'].'');
exit;
break;
I'm using case
because want to I update into a database. The problem here I believe is:
header('Location: ../ticket/listOfTicket.php?ticket_id='.$_GET['ticket_id'].'');
I don't know where to put the quote '
and "
. It will outputted in the URL like this:
http://localhost/ticket/listOfTicket.php?ticket_id=
It didn't display the ticket_id. Why?
Upvotes: 0
Views: 316
Reputation: 59709
You should always sanitize your user input. I could easily pass something you're not expecting to $_GET['ticket_id']. Assuming ticket_id is an integer, this works for me when I access the page and set ticket_id to some value.
header( 'Location: ../ticket/listOfTicket.php?ticket_id=' . intval( $_GET['ticket_id']));
exit;
Upvotes: 1