Jump to content
xisto Community
Sign in to follow this  
farsiscript

Receive Value Name With Php question

Recommended Posts

Hi dears
i make this form

form.htm

<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>New Page 6</title></head><body><form method="POST" action="send.php">Format="TEXT/CSV" S-Label-Fields="TRUE" -->	<p><input type="text" name="T1" size="20"></p>	<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p></form></body></html>

In form.htm file i have one input box with name T1 i want change
in send.php i use this code to receive T1 value :
$catid = $_Post['T1'];
But in send.php i dont know that is T1 name
i want receive all value sending form "form.htm" in "send.php"
for example when i want make dynamic form with "n" inputbox i dont know name of inputbox in send.php
sorry my english is not very good
if you know tutorial or sample soruce about this topic please help me
thanks :)

Share this post


Link to post
Share on other sites

Pass the name of the input as a hidden value with the form.

<form method="POST" action="send.php">Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p><input type="text" name="T1" size="20"></p>
<input type="hidden" name="name1" value="T1">
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

and then check for the $_post('name1') in the receiving code.
A friend from another forum has a form which uses this method. I will post a link here asap.
Also, for recursion, add another hidden field to tell you how many values the form is passing.

*edit to add link*

This is a tutorial about how to use this technique on a mail form, but modify it for your purposes.
It should work our fine.

Generic Mail Form Tutorial

Share this post


Link to post
Share on other sites

Hi Dear jlhaslip nice help ,what is this text "Format="TEXT/CSV" S-Label-Fields="TRUE" --> " ?if we have 3~n inputbox we must use javascript to overwrite name in hidden text input ?for example we compile form with echo in form.php or form.htmecho "form details with inputs "we must receive all input name in hidden input box ?thanks dear

Share this post


Link to post
Share on other sites

Well thats quite easy if the name is not imprtant or if the name is common and it has many subfields that you just have to process.My method includes an array and a foreach loopYou could name the input fields as say 'name[]'.Notice the square brackets([]).Name all of your fields with this name.In PHP it would be posted as a array.So you could use its values as $_POST['name'][n]('n' stands for the array key).To process the fields use the foreach loop.This method is used for multiple input fields whose numbers are not fixed and keep on varying e.g. for a multiple file upload it is used.However yo wouldnt know the actual use of a particular field as thats not you objective.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.