如何使用隐藏字段进行多表单提交

如何使用隐藏字段进行多表单提交

问题描述:

I have a form that i want to filled up by the end user in few steps. in the first step i want to let them fill Name,Address,Mobile number. And when click next button i want to appear another part of the form to fill the other details such as upload a image . i did research online,i found 2 articles useful, One thing is about sessions and the other thing is about hidden fields. In my opinion i think sessions are not a good way to use for form submitting.Because some browsers are might have disabled sessions. So ill go with hidden fields.

In my database i have a unique id which is auto increment.What i want to do is to let user to submit a form.In the first step i want them to submit their name,addres,mobile number(In this time it is inserting data to the database- Only for couple of columns.) And in my database i have a field for upload a image.In the first step it gets a null value.I want to update that null value in the next step by getting a that id from the first step

Please give me the basic idea to start this.A little help much appreciated! Thanks in advance

you can try like this:-

You can add a class on the input which you want to hide

<input type="text" name="example" class="inputHidden">

after that add style in your page like this

<style>
.inputHidden{
    display:none;
}
</style>

If you're trying to place the form data into new, hidden inputs - take the initial input.

<input type="text" name="example">

On the next page add a hidden input.

<input type="hidden" name="exampleP2" value="<?php echo $_POST['example']; ?>">

You can get form submited data and use it in input hidden fileds for e.g. in first form you have name ,email etc fields in other form you have more fields here you can use <input type="hidden" name ="firstname"> and thus you can add as many as you want