0
<?php
    echo "<a href='display_emp.php?employee_id=$rs['emp_id']; onClick=\"return confirm('Are you  that you` `want to DELETE this Data?')\" ><FONT COLOR='#F00'>Click To Delete</FONT></a>";
?>

error: Parse error: parse error, expecting T_STRING or T_VARIABLE or T_NUM_STRING'

I am newbie in PHP, can anyone teach me how to solve this error? thanks..

6 Answers 6

1

Try something like:

echo "<a href='display_emp.php?employee_id=".$rs['emp_id']."' onClick='return confirm(\"Are you  that you want to DELETE this Data?\")' ><FONT COLOR='#F00'>Click To Delete</FONT></a>";

Let me just say: that is some terrible html your using there...FONT...really??

Sign up to request clarification or add additional context in comments.

Comments

1

Just remove the quotes surrounding emp_id ($rs[emp_id])

echo "<a href='display_emp.php?employee_id=$rs[emp_id]; onClick=\"return confirm('Are you that you want to DELETE this Data?')\" ><FONT COLOR='#F00'>Click To Delete</FONT></a>";

Comments

0

You are using the double quotes (") inside your string, this makes the string end prematurely and that causes the error.

onClick=\"return 

That's your problem

1 Comment

But it's escaped, so shouldn't that be valid?
0

When you're putting an array-variable with alphabetic index, you should not use another quote.

Here, this one will be correct:

echo "<a href='display_emp.php?employee_id=$rs[emp_id];' onClick=\"return confirm('Are you  that you` `want to DELETE this Data?')\" ><FONT COLOR='#F00'>Click To Delete</FONT></a>";

or as Sammaye suggested, concatenate different parts of strings.

Comments

0

this is the solution

$test = $rs['emp_id'];
$msg = "Are you  that you want to DELETE this Data?";
echo "<a href=display_emp.php?employee_id=".$test." onClick='return confirm(\"".$msg."\")' ><FONT COLOR='#F00'>Click To Delete</FONT></a>";

Comments

0

This should work:

<?php
echo "<a href=\"display_emp.php?employee_id=" . $rs['emp_id'] . "\" onClick=\"return confirm('Are you  that you want to DELETE this Data?');\"><FONT COLOR=\"#FF0000\">Click To Delete</FONT></a>";
?>

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.