-1

I'm using codeigniter for my project where I have situation to submit two different but one in another. Can I add one form into another form?

So it'll look like this:

<?php echo form_open('controller1');?>
// All form1 stuff here

  <?php echo form_open_multipart('controller2')?>

  //All form2 stuff here
  //Form2 submit button

  <?php echo form_close();?>

//Form1 submit button
<?php echo form_close();?>

Will codeigniter allow me to do this? I searched for while for this problem but didn't find for my case. Or is there any another way to do this.

Any help is appreciated.

Regards,
Vaibhav M.

11
  • Some context would be helpful. Why do you need to do this? Why not submit one single form and reroute your data from your controller to different models? Commented Jul 22, 2018 at 17:46
  • 1
    stackoverflow.com/questions/26536861/… Commented Jul 22, 2018 at 18:31
  • 1
    Nothing to do with ci, and no, it isn't allowed/valid Commented Jul 22, 2018 at 19:59
  • 1
    Possible duplicate of Are nested forms valid in HTML5? Commented Jul 22, 2018 at 22:29
  • 2
    is this a serious question? first you can try it by yourself if it is working or not in ci - its not that hard to try this out... and second it doesn't matter if that works or it doesn't work - nested forms are invalid html which sooner or later will lead to problems - either you are capable to learn such things or imho you shouldn't ask this kind of question Commented Jul 23, 2018 at 18:16

1 Answer 1

0

Here is the answer:

No, we can't use nested forms in codeigniter. As displayed in the question, inner form executes successfully but outer form could not execute.

As user Alex told codeigniter does not allow nested forms. As well as other users said it is not valid in HTML too. As codeigniter is a part of HTML it does not allow like it's parent policies (Didn't found proper word for it).

Why? The reason is in this question.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.