Jump to content

parsing question (error)


LC8Joe

Recommended Posts

Hi Jessica, thank you very much for your answer but it seams that I just don't get it :confused:

 

I'm trying to get the value of $i when I click the link but even when I don't get a parse error, it will call function= with no value returned :sweat:

 

$i = 55;

echo '<a href=\"'.$_SERVER['PHP_SELF'].'?function="$i"'.">Click here to call the function</a>";

if(isset($_GET['function']))
{
    echo $_GET['function'];
}
 

Try this:

 

echo '<a href="' . $_SERVER['PHP_SELF'] . '?function=' . $i . '">Click here to call the function</a>';

 

What Jessica meant was you could do this:

 

echo "<a href=\"{$_SERVER['PHP_SELF']}?function={$i}\">Click here to call the function</a>";

 

Double quotes will allow you to place variables in he string. However, the first method is quicker to parse :)

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.