473,394 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

dynamic $_POST - help please

Hi there,

I am tryin to use a $_POST variable but the name of the form element
is dynamic. Below is the code I am tryin but is obviously wrong as it
isnt working:
$abc = $_POST['abc_' . $value]; //isnt working as is
If $value had a value of 44, the above code would be represented as:
$abc = $_POST['abc_44'];
As I require that the line be quite generic to whatever the value of
$value is, I need to do it like the first snippet. What is the correct
way of writting this? Cheers

Burnsy
Jul 17 '05 #1
4 2090
Carved in mystic runes upon the very living rock, the last words of
mr_burns of comp.lang.php make plain:
I am tryin to use a $_POST variable but the name of the form element
is dynamic. Below is the code I am tryin but is obviously wrong as it
isnt working:
$abc = $_POST['abc_' . $value]; //isnt working as is


There's no reason that shouldn't work, assuming there actually is a key in
$_POST with that value. Why not try dumping it and see?

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
Jul 17 '05 #2

mr_burns wrote:
Hi there,

I am tryin to use a $_POST variable but the name of the form element
is dynamic. Below is the code I am tryin but is obviously wrong as it
isnt working:
$abc = $_POST['abc_' . $value]; //isnt working as is
If $value had a value of 44, the above code would be represented as:
$abc = $_POST['abc_44'];
As I require that the line be quite generic to whatever the value of
$value is, I need to do it like the first snippet. What is the correct way of writting this? Cheers


That should work.

What isn't working? Dump your $_POST array and see if what you're
looking for is really there.
Show us the real code that isn't working. Or a URL of an example.

Ken

Jul 17 '05 #3
mr_burns wrote:
I am tryin to use a $_POST variable but the name of the form element
is dynamic. Below is the code I am tryin but is obviously wrong as it
isnt working:
$abc = $_POST['abc_' . $value]; //isnt working as is


Why isn't it working?
What did you expect that to put into $abc?
What did that put into $abc?
How did you test?

Post some more code, please.

The reason that is not working /may be/ something else ...

--
Mail sent to my "From:" address is publicly readable at http://www.dodgeit.com/
== ** ## !! !! ## ** ==
TEXT-ONLY mail to the complete "Reply-To:" address ("My Name" <my@address>) may
bypass the spam filter. I will answer all pertinent mails from a valid address.
Jul 17 '05 #4
Hi again,

Sorry, my mistake. I hadnt properly named the text box to link up with
the script. Thanks for the help anyway

Burnsy
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: diroddi | last post by:
I am having a problem using a dynamic where clause. I have a feeling that I am overlooking something very simple, although I can't seem to figure it out. The error i'm getting is: You have an...
1
by: RDizzle | last post by:
okay. so all i am doing is changing a registration script that uses $_GET to a script that uses $_POST, but the validation script now returns NULL values for all posted vars. What's the deal? ...
2
by: GustavoBrust | last post by:
Hello everyone. I'm having a problem with a search I want to make. It's like this: The user can choose about 15 checkboxes to be his search pattern. According to the combination of...
2
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs,...
7
by: Bertman105 | last post by:
Hey all, Heres the situation: I have a form page that needs to have multiple drop down menus that is pulling their options from a database. Right now I have one working out of 3. So that is one...
26
by: Jerim79 | last post by:
I need to create a form that takes a number that the user enters, and duplicates a question the number of times the user entered. For instance, if the customer enters 5 on the first page, when...
7
by: Jerim79 | last post by:
My situation is that I have a form that asks the user for a number. Next, I execute a while loop that displays a group of questions the amount of times the customer entered. For instance, the loop...
1
by: Miyagi | last post by:
I am creating a simple "or so I thought" php/mysql survey. There are 3 types of Surveys, with different questions. 1 for Clients, 1 for Employees, 1 for Peers. Questions for each survey are...
2
by: keeps21 | last post by:
I have a script that recieves an id number via the address bar when a link is clicked. ie . index.php?id=1 if the link was for the story whose ID is 1. My script checks if a user is logged in,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.