Jump to content

problwm with php loop


saco721

Recommended Posts

Hi,

could you help me with this code I need to complete my project.

 

Each time "Download" is clicked I need to decrement the downloads by 1, then once downloads reaches 0, the download function becomes disabled. How do I do this? -  have tried but cannot get it to work.

 

 

for ($i=1; $i <= $num_cart_items; $i++)

 

{

 

echo ("<td>" . $keyarray["item_name".$i]. "</td><td align=left>" . $keyarray["option_name1_".$i]. "</td><td align=left>"  . $keyarray["option_selection1_".$i] . "</td><td align=center>");

 

 

echo ($keyarray["option_name2_".$i]. "</td><td align=left>"  . $keyarray["option_selection2_".$i] . "</td><td align=\"center\">". $keyarray["quantity".$i] ."</td></tr>");

 

 

//have tried below, returns errors, any ideas?

 

if($i>0){

echo "<tr><td><a href=\"http://www.test.com/\" . $keyarray["item_name".$i] . ".mp3\">Download</td></tr>";

i--;

}

else

{

echo"<tr><td>Download Limit reached</td></tr>"; 

}

echo ("</table>

 

");

Link to comment
https://forums.phpfreaks.com/topic/55075-problwm-with-php-loop/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.