Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onClick Event Handler... 1

Status
Not open for further replies.

venetianjigsaw

Programmer
Mar 25, 2005
29
US
I am able to delete an entry from mySQL but want to also display an option to the user [client side] that either confirms the delete or cancels. My problem is this: while I am comfortable in writing the onClick event handler, I am having problems in using it in conjunction with my php script:

<td style='text-align:center;'>
<input
type='button'
value='Delete'
onclick='window.location="return confirm('Are you sure?')"; "delStudent.php?student=<?php echo $myrow["stnum"]; ?>"'
/></td>

Does anyone have an idea as to how I can incorporate my js with php?

Thanks

venetianjigsaw
 
cLFlaVA;

Well, I just tried the code and it's not working. Have any other suggestions?

Thanks
venetianjigsaw
 
Okay, sorry about that. Here's how I have it written, but when I click Delete, it doesn't like it:

<td style='text-align:center;'>
<input
type='button'
value='Delete'
onclick="if (confirm('Are you sure?')) 'window.location="delStudent.php?student=<?php echo $myrow["stnum"]; ?>"'
/></td>

Is there an issue w/ comma placement?

Thanks
venetianjigsaw
 
i don't see a single comma in there. i see single quotes that shouldn't be there.

Code:
<input
type='button'
value='Delete'
onclick="if (confirm('Are you sure?')) { window.location='delStudent.php?student=<?= $myrow["stnum"]; ?>'; }" />

*cLFlaVA
----------------------------
[tt]your mom goes to college[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top