开发者

Passing information from forms and your own information

开发者 https://www.devze.com 2023-03-14 09:58 出处:网络
How do I pass information from my form plus some additional data when submitted the form. For example if I am using PHP

How do I pass information from my form plus some additional data when submitted the form. For example if I am using PHP

I have a form and I set the method to GET; now all the fields in the form will be sent in the URL, now suppose if I want to keep a track of how many times the submit is clicked, for that if I pass the variable count along with all the data through URL, how do I do that?

How do I append this data to the existing form's data?

OR suppose if I have a field in my form where I allow to开发者_高级运维 user to enter name of their employs; initially it will show 4 fields for the data, but if I click the submit type button that says MORE, then it will display 4 more fields, and similarly if again he presses more it shows 12, so I was thinking maybe I could sent a variable $count along with the form data through URL, but I don't know how to do it.


I would user a hidden field with the "count" value. It will then be passed with all the other form input variables but won't actually be visible to the user on in the form:

<input name="field_name" type="hidden" value="cout_value_that_changes" />

You can change - Field_name - to what ever you want it to be and the value should be incremented every time the submit button is pressed - incremented with PHP - something like:

$count++;

value="<?php echo $count;?>"


Best solution for your requirement seems Use of JQuery. Add your fields dynamically using JQuery. For ref. you may check : http://docs.jquery.com/Main_Page

Without using JQuery, you can have Hidden field which would contain count of the field. we have to pass count in GET request and while showing field in php, check count field.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号