Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Receive Value Name With Php, question
farsiscript
post Sep 30 2006, 03:15 PM
Post #1


Super Member
*********

Group: Members
Posts: 357
Joined: 8-April 06
Member No.: 21,487



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
Go to the top of the page
 
+Quote Post
jlhaslip
post Sep 30 2006, 03:25 PM
Post #2


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 3,993
Joined: 24-July 05
From: In Trouble Again... still?
Member No.: 9,787
Spam Patrol



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
Go to the top of the page
 
+Quote Post
farsiscript
post Sep 30 2006, 03:58 PM
Post #3


Super Member
*********

Group: Members
Posts: 357
Joined: 8-April 06
Member No.: 21,487



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
Go to the top of the page
 
+Quote Post
electron
post Oct 1 2006, 06:20 AM
Post #4


Premium Member
********

Group: Members
Posts: 162
Joined: 10-May 06
Member No.: 23,375



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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Problem With My Email : [urgent](1)
  2. Non-visible Disabilities(15)
  3. Pop3 Email Supported?(2)
  4. Can't Receive Emails To My Websites Google Apps(4)
  5. Cannot Receive Pms(11)
  6. Interesting Breakup(6)
  7. didn't receive FH PM(1)


 



- Lo-Fi Version Time is now: 5th September 2008 - 12:10 PM