I want to echo this line in PHP simply by using "echo", but it doesn't work. How can I fix it?
echo '<p><input type="button" name="Back" value="Back" onclick="window.location ='viewusers.php'" /></p>'
You need to escape the quotes, or better, change to single quotes like this: (still needs escaping at the end there)
echo '<p><input type="button" name="Back" value="Back" onclick="window.location =\'viewusers.php\'" /></p>';
It's better to do single quotes because then php doesn't parse it like it does with double quotes. A better explanation is in the php docs.
Another option is to close the php block, like this: (then you don't have to worry about escaping quotes)
<?php
[your php code]
?>
[your html line or block]
<?php
[more php]
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With