开发者

Basic PHP Script [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I'm trying to make a script to do the following:

http://mydomain.com/script.php?name=bob

That link would output to a blank page with text

Hi bob

Anyone know what the contents of script.php sh开发者_如何学Goould be?


<?php echo 'Hi ', htmlspecialchars($_GET['name'], ENT_QUOTES), ' and welcome'; ?>

or simply

<?php echo 'Hi '. $_GET['name'] .' and welcome'; ?>

You should learn PHP from a book or tutorials. This is not the way to learn it.


<?php

echo 'Hi '. $_GET['name'];

?>

Making sure of course to sanitize your variables before you use them for anything.


if the text that is name = bob coming from db. then you can $_GET the name and concatenate that here.

for button or submit

onclick="location.href='script.php?name=<?php echo $name ?>'"

for text link

<a href="script.php?id=<?php echo $name;?>">view</a>

write this in script.php

<? php echo 'HI'.$_GET['name']; ?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜