User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 397,598 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,848 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1620 | Replies: 18 | Solved
Join Date: Oct 2007
Posts: 174
Reputation: Venom Rush is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 2
Venom Rush's Avatar
Venom Rush Venom Rush is offline Offline
Junior Poster

Problems with form submition

  #1  
Apr 3rd, 2008
Hi there

I have a form that I'm trying to submit but it just doesn't want to play nice.

The form i have has 2 submit buttons. One processes php code that updates info in a DB and the other deletes the info in the DB. The problem is that I have a popup asking for confirmation on the deleting and when I click ok nothing happens. All I need to know is how to submit my form using javascript so that it processes the PHP code to delete the DB entry.

form tag and delete button
<form name="formname" id="formname" method="post"  action="<?= $_SERVER['PHP_SELF']?>" onSubmit="return checkWholeForm(this);">

<input onclick=\"confDelete()\" type="submit" name="delete" value="Delete">

confirmation popup
  1. <script type="text/javascript">
  2. <!--
  3. function confDelete() {
  4. var answer = confirm("Msg")
  5. if (answer==true){
  6. document.formname.submit();
  7. return true;
  8. }
  9. }
  10. //-->
  11. </script>

Code that deletes DB entry
  1. if (isset($_POST['formname'])){
  2. \\ code goes here
  3. }
This user has a spatula. We don't know why, but we are afraid.
AddThis Social Bookmark Button
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
&bul