0

I have this link:

echo"<a href=\"$urlHTML\" onclick="return confirm('Please Confirm You Wish to Add these Details')">Delete</a>";

It is used to pass a stripped character link to a page, but before doing so a javascript function is employed to get the user to confirm they want to proceed. Basically, on the link above I'm getting the following error:

Parse error: syntax error, unexpected T_RETURN, expecting ',' or ';' in E:\xampp\htdocs\IDB\delete.php on line 411.

If anyone could tell me where I'm going wrong that would be great!

5 Answers 5

1

this one should worK:

echo '<a href="'.$urlHTML.'" onclick="return confirm(\'please confirm\')">Delete</a>';
Sign up to request clarification or add additional context in comments.

Comments

0

Try:


echo "<a href=\"$urlHTML\" onclick=\"return confirm('Please Confirm You Wish to Add these Details')\">Delete</a>";

Comments

0

escape the " sign

echo"<a href=\"$urlHTML\" onclick=\"return confirm('Please Confirm You Wish to Add these Details')\">Delete</a>";

Comments

0

make it like this

 echo"<a href=\"$urlHTML\" onclick=\"return confirm('Please Confirm You Wish to Add these Details')\">Delete</a>";

You have forgot to escape the inner double quotes of onclick.

Comments

0

separate PHP and HTML

?>
<a href="<?=$urlHTML?>" onclick="return confirm('Please Confirm You Wish to Add these Details')">Delete</a>
<?php

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.