Page 1 of 1

Forum Posts and While Loop

Posted: Mon Jul 21, 2008 12:11 am
by leebrent
Hello,

Can someone shed some light on the following piece of code? No matter what I do the $_POST will not work. I know the posts are making it over the the page. It's like PHP will not put the $serviceName information from the query into the print line...

Code: Select all

include("mysql_connect.php");
$sql = 'SELECT serviceID, serviceName FROM service';
$query = $DB->Query($sql);
while($array = $DB->FetchArray($query)){
        extract($array);
        print $serviceName." Value: ".$_POST['$serviceName']."<BR />\r";        
    }

Re: Forum Posts and While Loop

Posted: Mon Jul 21, 2008 12:49 am
by Christopher
Try

Code: Select all

include("mysql_connect.php");
$sql = 'SELECT serviceID, serviceName FROM service';
$query = $DB->Query($sql);
while($row = $DB->FetchArray($query)){
        print $row['serviceName']." Value: ".$_POST[$row['serviceName']]."<BR />\r";        
    }
The problem was '$serviceName'.

Re: Forum Posts and While Loop

Posted: Mon Jul 21, 2008 12:56 am
by leebrent
Thanks,

That solved my issue!

--B :D