Strange syntax problem

I have this echo statement:

$token=555555;
echo '<a href="http://localhost/Appointments/Frontend/pass_reset.php?t="'.$token.'">link</a>';

The problem with the above is that the value of $token does not appear in the link.
This is what gets printed in the browser:
http://localhost/Appointments/Frontend/pass_reset.php?t=

I really cannot explain it.

does it work if you put

$token ='555555';

?

How about if you make it a string rather than a number?

$token='555555';
1 Like

that’s caused by the " just before you add the number. it prematurely closes the attribute value. see the HTML source code vs. the DOM tree (use the dev tools for that).

3 Likes

yes that was the problem…thanks.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.