Jul 26, 2008

Receive Value Name With Php - question

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

Receive Value Name With Php - question

farsiscript
Hi dears
i make this form

form.htm
CODE
<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 :
CODE
$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 smile.gif

 

 

 


Reply

jlhaslip
Pass the name of the input as a hidden value with the form.
QUOTE
<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

 

 

 


Reply

farsiscript
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.htm
echo "form details with inputs "
we must receive all input name in hidden input box ?
thanks dear

Reply

electron
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 loop

You 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.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics
Looking for receive, php

Searching Video's for receive, php
advertisement



Receive Value Name With Php - question



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE