Jump to content

Recommended Posts

< noobian to php and web programming in general >

 

Is there a way to 'submit' a form on lost focus? This is my code, generated in Dreamweaver:

<form action="<?php echo $editFormAction; ?>" method="post" name="erDets" id="erDets">
  <table align="center">
    <tr valign="baseline">
      <td nowrap align="right">Date of Charge:</td>
      <td><input type="text" name="fdate" value="" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Vendor:</td>
      <td><input type="text" name="vendor" value="" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Description:</td>
      <td><input type="text" name="description" value="" size="32"></td>
    </tr>

    <tr valign="baseline">
      <td nowrap align="right"> </td>
      <td><input type="submit" value="Insert record"></td>
    </tr>
  </table>
  <input type="hidden" name="erID" value="<?php echo((isset($_COOKIE["ERID"]))?$_COOKIE["ERID"]:"") ?>">
  <input type="hidden" name="MM_insert" value="form1">
</form>

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/50391-solved-submit-on-lost-focus/
Share on other sites

Maybe I should start over. This post began in the php help forum and was kicked over here. What I am trying to accomplish doesn't seem totally unique so it very likely the way I am asking the question which is keeping me from finding the answer.

 

This is an expense report problem. I have 3 tables that make up an expense report: expensereport, erDets, and erSplits.

 

The reason for the 3rd table is that in some cases the employee will need to split an expense into multiple lines due to multiple projects being covered by one expense item. What I want to do is create an interface that makes it seem like the user is entering into just 2 tables (expensereport, details) so the need I have is to combine the 2 tables (erDets, erSplits) into one form -- or at least the appearance of one form.

 

My first thought is to have one form submit without any notice to the user. Then I would pull back the key id and use it in the next form before finally submitting.

 

Another idea is to have just one button that submits both forms. Could I make a button that when clicked would do the following (feel free to boot me back to the php forum, moderator):

 

1. query one: insert into erDets (form1)

 

2. retrieve the newly created key ($var = mysql_insert_id();)

 

3. query two: insert into erSplits ($var,  form2)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.