Jump to content

[SOLVED] Nested Forms....


Alexhoward

Recommended Posts

Are you sure you mean "nested" forms where one form is inside another form? If you mean separate forms (as genericnumber1 suggests, then you just need separate forms). But, I have never heard of nested forms.

 

I did a quick test where a form was inside another form. I suppose you are expecting if the inner form is submitted that only the inner form data is sent. Whereas if the outer form is submitted then both forms' data is sent. But, my tests showed that all the data from both forms is always sent and in some cases some fields were not sent based upon the layout of the two forms.

 

Not sure what you are trying to accomplish here. More details please.

Link to comment
https://forums.phpfreaks.com/topic/134407-solved-nested-forms/#findComment-699763
Share on other sites

Hi Guys,

 

I didn't think it was possible....

 

Yes i mean "nested" (a form within a form)

 

The reason being that i have a booking form with a discount code input.

 

i wanted to be able to submit the discount code (if entered) and if it exsists to discount the total.

 

Then the final submit to send all the infomation to MySQL...

 

I just didn't want to use javascript, but i guess i should...

 

Thanks for your help

Link to comment
https://forums.phpfreaks.com/topic/134407-solved-nested-forms/#findComment-700246
Share on other sites

what you want : to submit the discount code only if one is submitted

 

what you need to do : check if user submitted a discount code on the next page, then do a simple

 

$discountcode = clean_data/trim/whatever($_REQUEST['discountcode']);

if its not empty, submit to database

 

Link to comment
https://forums.phpfreaks.com/topic/134407-solved-nested-forms/#findComment-700657
Share on other sites

Thanks for all our replies,

 

However,

 

as both buttons submit the entire form, but only submit the button name pressed,

 

I will run one querie is one button is pressed and another if teh other is pressed,

 

saving all teh inputs into sessions, and displaying them again in teh form if they are set.

 

This will work, as a work around, and that'll do

 

Thanks for your help!

Link to comment
https://forums.phpfreaks.com/topic/134407-solved-nested-forms/#findComment-700940
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.