Jump to content

:o calculations on same page and able to store to DB


BluePhoenixNC

Recommended Posts

First things first... english is not my native language, so I apologize if my explantaions are long winded or problematic to understand.
Here is my problem: I have a form in which next to some simple data (Name address etc) some calculated values need to be produced and be able to be stored in a DB.
I.E a mortgage Calculator comes to mind (same principle). Here is what I have so far:
Form with input (name and address and some values to do calculations with. I was thinking about sessions by parsing the information to another form PLUS the calculated values, but there are more than one calculation to be performed and it should be "flexible" to allow several scenarios. So now I am stuck.
take Excel for example I can put in field 1 and field 2 a value, have that calculate in field 3 but the header is untouched (Name address etc.) By searching the board I heard of AJAX, but I have no clue how to implement that.
I was also thinking about IFRAMES but can I do calculations in there independently from the main form, so I can then pass ALL variables to another Form and then save to DB ?!
I am stumped and don't really know how to proceed with this....

Thanks for the help, in advance
Link to comment
Share on other sites

I post multiple data queries to different iframes based on a single input form on a site... it works great for me. You should have no problem with what you are trying to do. You could perhaps take the form, then ask them from a listbox what to do with the data
Link to comment
Share on other sites

[!--quoteo(post=358127:date=Mar 24 2006, 10:31 PM:name=AV1611)--][div class=\'quotetop\']QUOTE(AV1611 @ Mar 24 2006, 10:31 PM) [snapback]358127[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I post multiple data queries to different iframes based on a single input form on a site... it works great for me. You should have no problem with what you are trying to do. You could perhaps take the form, then ask them from a listbox what to do with the data
[/quote]
hmmm it's late and after almost a week of trial and error, I might be a bit slow in understanding. Say I have a form structred like that:
[code]<form>
<table ..>
<tr><td>
<input class="frm" type="text" name="d_ccity" size="30" /></td></tr><tr>
<td><input class="frm" type="text" name="d_State" size="30" /></td>
...
<td>
<iframe> <form action="<?=$thisform;?>">
<table>
<tr><td><input class="frm" type="text" name="x" size="30" /></td></tr>
<tr><td><input class="frm" type="text" name="y" size="30" /></td></tr>
<tr><td><input class="frm" type="text"  readonly name="z" size="30"  value="<?=echo phpfunction(x+y);?>" /></td></tr>
<tr><td>[calculate]</td></tr>
</table>
</form></iframe>
<tr><td>[Submit]</td></tr>
</table></form>[/code] <-- very simplified code
That upon hitting the submit button, not only the city and state variables but also the x,y,z variables will be saved into a session ? and therefore usable for future procedures ?
If that would be that easy, that would be awesome, but for some reason I am not sure that this works. I might have a logical Jetlag.
Any guidance is greatly appreciated. Thanks for the quick response.
Link to comment
Share on other sites

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.