Jump to content

[SOLVED] link appear after button clicked problem


zgkhoo

Recommended Posts

if(isset($_REQUEST['button']))
{

<a href=home.php>home</a> <--this line got error..

}


 

i intend to write after the user click the button then appear a "HOME" word link and when the user click the "HOME", then it bring user back to the main page. but i write like that got error,

and if i put the bellow which with <html> tagas..also cant..

 

if(isset($_REQUEST['button']))
{
<html>
<a href=home.php>home</a> <--this line got error..
</html>

thanks..

if(isset($_REQUEST['button']))
{

echo "<a href=\"home.php\">home</a>";

}

 

If u want to print html inside php u have to echo it and also consider escaping double quotes with slashes. An alternative may be:

 

<?php
if(isset($_REQUEST['button']))
{
?>

<a href=home.php>home</a>

<?php
}
?>

 

In this way u have html and php code working individually, but that probably a good way when dealing with large amount of html code which may be frustrating to echo and escape.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.