Determining if POST variables exist after form submission

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dwightlathan77
Forum Newbie
Posts: 3
Joined: Thu Jul 31, 2008 11:14 pm

Determining if POST variables exist after form submission

Post by dwightlathan77 »

Hi everyone, I wrote a form with dynamic input creation. The first input in a section is named section_0 with each input added named successively, section_1, section_2, etc.

I've been trying to write a while loop that cuts off when it encounter a POST variable that's not set, but haven't been able to dynamically reference the $_POST variable['section_?']. This is something like I've been trying:

while (ISSET($_POST['{"deliverable_".$count}'])
{
$deliverable[$count] = $_POST['{"deliverable_".$count}'];
$count ++;
}

Any suggestions on how to do this or do it better?
dwightlathan77
Forum Newbie
Posts: 3
Joined: Thu Jul 31, 2008 11:14 pm

Re: Determining if POST variables exist after form submission

Post by dwightlathan77 »

This was quite easy to do and, I thought I had tried this before, but the answer is below for anyone interested running php 5.

while (ISSET($_POST["deliverable_" . $count])) {
$deliverable[$count] = $_POST["deliverable_" . $count];
$count ++;
}
Post Reply