|
-
June 9th, 2008, 05:35 AM
#1
[RESOLVED] onclick and submit form, with if(confirm())
Hi all,
i have recently come across a problem with my code while trying to use JavaScript with a form, simply when i use the onclick function my form will not submit, what i want is a confirmation dialogue to pop up and if the user clicks yes the form submits, if they click no nothing will happen. This needs to happen using POST since my code deletes an entry from the database.
heres the code im using in the form.
Code:
echo '
<form action="editLinks.php" method="post">
<input type="hidden" name="edit" value="true" />
<input type=hidden name=delete value=true />';
echo "
{$row['name']}
<input type=\"hidden\" name=\"deleteid\" value=\"{$row['id']}\" />
</td>
<td>
<input type=\"submit\" name=\"Delete\" value=\"Delete\" onclick=\"javascript: if(confirm('Are you sure you want to delete?')) this.form.submit();\" />
</form>
i already posted this in the PHP section by mistake, would be appreciated if a mod could delete it for me.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|