PHP passing variable id through href

后端 未结 4 1586
一向
一向 2020-12-10 20:08

I want to have a link to another page, with particular subject, How can I pass the id ?


        &         
4条回答

There is also a short form echo tag enabled on most PHP servers

On the subsequent page you retrieve the parameter from the GET array:

$subject = $_GET['id'];

If you're passing this value to the database you should do some validation:

if ($_GET['id']) { // check parameter was passed
  $subject = int_val($_GET['id']) // cast whatever was passed to integer
} else {
  // handle no subject case
}

提交回复
热议问题
subject;?> Add Topic