insert_id作为href? [关闭]

Hopefully a very easy question, but I am stuck. I have a page for creating a new user on my system, after the user is created I display the users id.

printf("New member added. The new member ID is %d 
", $mysqli->insert_id );

Can someone tell me how to turn this into a link ? I want to be able to click on the ID and be taken to /display=ID number.php Ive tried putting it into a a href but it keeps failing.

Was thinking something like

 printf("New member added. The new member ID is <a href="display=%d"> 
", $mysqli- >insert_id );

Thanks

You just have to put the HTML for the link into the printf statement, with the %d where you want the ID to be in the URL. Just make sure the quotes match; that you aren't using double quotes inside the double quoted string without escaping them.

You can create link like this <a href="display=<?php echo $mysqli->insert_id; ?>.php">ID Link</a>

In your case you need escape " or use '

printf("New member added. The new member ID is <a href=\"display=%d\">Link</a> ", $mysqli- >insert_id);

You need to pass it in the URL using GET parameters:

?param1=value1&param2=value2&param3=value3

Then in PHP you can read the values of these params like:

$_GET['param1']
$_GET['param2']
$_GET['param3']
<?php printf("New member added. The new member ID is <a href=\"display=%d\">Link</a> 
", "$mysqli- >insert_id");
?>

I tested.Itz working fine.