<?if (isset($FORM_SEND)){
if (isset($HTTP_POST_VARS))
{while(list($name,$value) = each($HTTP_POST_VARS))
{$$name = $value;};
};
$month = $monthin;
$day = $dayin;
$addnow = true;
if(isset($addshowsnow)){
for($k=1;$k<=$i;$k++){
//THIS IS THE SECTION I'M TRYING TO FIGURE OUT!!!!
//$hourin=$hourin_$k;
//$minutein=$minutein_$k;
//$showin=$showin_$k;
//$endhour=$endhour_$k;
//$endminute=$endminute_$k;
$sql = "insert into program (month,day,starth,startm,show,endh,endm) values ('$month','$day','$hourin','$minutein','$showin','$endhour','$endminute')";
echo("ADDED");
// Execute a query and store the result
$res = mysql_query($sql,$dbh);
}
}
?>
.....Up here the user can insert the month and day they want to be scheduling for........
<?if(!isset($amountshows)){?>
<b>How many different shows do you want to schedule?
</b> <input name="amountshows" type="text" size="2"><br>
<?}?>
<?if($addnow){
for ($i = 1; $i <= $amountshows; $i++){
echo("<b>Start Time</b>:<select name=\"hourin_$i\">\n");
echo("<option value=\"01\">1</option><option value=\"02\">2</option>.....
......there's a LOT more options, and more selectors - eventually the user will input
values for the hour in, the minute in, the show name, end hour, and end minute.
The point is, each time it goes through, it creates a name "hour_1" or "hour_2"
depending on the slot the user is scheduling. The _1 or _2 comes from the loop
variable $i......
}
$i--;
echo("<INPUT TYPE=\"hidden\" NAME=\"addshownow\" VALUE=\"2\">\n");
}?>
<input type="submit" name="send">
</form>
Here's a link to the current page - http://www.thehamchannel.com/programit.php.
What I'm trying to do is loop through my created variables .... when the user presses submit and the first show they want to program is returned, you have the variables $hourin_1, $minutein_1.... created. It creates $hourin_x for whatever x number of programs the user wants to schedule.
How can I loop through these to store the unique variables in the database?
Hope this makes sense. Can you concatonate variable names? Or create variable variable names?