Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 20th, 2004, 7:53 PM   #1
~A!
Newbie
 
Join Date: Dec 2004
Posts: 1
Rep Power: 0 ~A! is on a distinguished road
Greetings, everyone! This is my first post, just running into a brick wall with some code I'm writing, having a hell of a time, and I found this site, so I thought I'd float the question here.

I have some JavaScript I wrote that opens an HTTP request to a php page, then inserts the product of the PHP into the current page, so that the page doesn't need to refresh in order to run the script. Entries from the PHP page get added to a table in the HTML, and they get assigned a unique identifier.

Trouble is, when I finally submit the form after all the items are entered, I don't know how many there will be. So I did a foreach loop to go through the post variables, but I can't get it to give me the variables from $_POST dynamically.

Basically, what I am trying to do is this:

 $varValue = $_POST['item_'.$count];

Where I can dynamically get the value out of post. Is this even possible?

~A!
~A! is offline   Reply With Quote
Old Dec 20th, 2004, 11:15 PM   #2
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
foreach($_post as $col => $val) 
  if(substr($val, 0, 5) == "item_") {
    $varValue = $val;
    /* .. Do stuff .. */
  }
__________________

tempest is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:26 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC