简体   繁体   中英

php append within a header

How would you add a variable within quotations marks? Here's what I'm trying to do but it's not working.

header("Location: mainpage.php?note=".$note_title);

Also is there a way to indent blocks of code on Stack Overflow without having to do four spaces on each individual line?

you mean like:

header("Location: mainpage.php?note=$note_title");

This is the standard way. If it is not working the problem is not with the code you posted.

As for the second part, you can use tabs, but not effectively in a browser window usually.

It does work. , as KingCrunch said.

<?php
$note_title="24";
header("Location: mainpage.php?note=".$note_title);
?>

像这样在你的值中添加双引号:

$note_title = '"your_value"';

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM