<a href="delete.php" OnClick="return confirm('blah blah');"> Click here </a>
<?PHP
ECHO"<a href='delete.php' OnClick='return confirm('blah blah');'> Click here </a>";
?>
</BODY>
</HTML>
the first link is a simple html link with an onclick event that displays a message that allows the user to confirm the link or cancel it. canceling it will stop the link from loading.
but when I ported it inside the php tags ( and changed the "" in the link code to ' ' in order for it to work with no errore. the return confirm event will not trigger and the page will load just as though there were no onclick event.
there has to be a way to make this work with php ( since it would be absurd for it not to work inside php tags ).
This thing you provided will not work...
Because the single quotes before the blah blah will point out an error..
single quote started before <a and it ends at confirm( ... and wt after that.. there's blah blah and then again single quotes..
This will be an error..
echo '<a href="delete.php" OnClick="return confirm('blah blah');"> Click here </a>';
Last edited by peter_budo; Dec 21st, 2008 at 4:45 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Hi, when I use return confirm
the title of the message shows the url of my page for example: the page say http://localhost..., you can change that title?
Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.
This thread is more than three months old
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.