Hello!

I was hoping that one of you PHP experts could help me with this dynamic "Add to Cart" button that I'm trying to make.

THANKS! Chris

PHP Code:
if($ws_booked1 $ws_maxNum){
$ws_NumAVL1 $ws_maxNum $ws_booked1;
echo 
'<form name="WA_eCart1_1_ATC_' $ID1 '" method="POST" action="' $_SERVER["PHP_SELF"];
echo (isset(
$_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:"";
echo 
'"><input type="hidden" name="WA_eCart1_1_ID_Add" value="'$ID1'"/>'
echo 
'<select name="WA_eCart1_1_Quantity_Add">';
echo 
'<option value="1" selected="selected">1</option>';
    for(
$ii 2$ii <= $ws_NumAVL1$ii++){
    echo 
'<option value="' $ii '">' $ii '</option>';
    }
    echo 
'</select>&nbsp;';
    echo 
'<input type="image"src="WA_eCart/Images/S1A_AddToCart.gif" border="0" value="Add To Cart" name="WA_eCart1_1_ATC" />
<input name="workshop_id" type="hidden" id="workshop_id" value= ' 
.$ws_id' />
<input name="ID" type="hidden" id="workshop_id" value= ' 
.$ID1' />
<input name="workshopDate_id" type="hidden" id="workshopDate_id" value= ' 
$ws_dateID1 ' />
<input name="workshop_name" type="hidden" id="workshop_name" value= ' 
$ws_name ' />
<input name="workshop_price" type="hidden" id="workshop_price" value= ' 
$ws_price ' />                              </form>'
      } else if(
$ws_booked1 >= $ws_maxNum){
    echo 
"Sorry fully booked!";
    } 
The problem seems to be here:
PHP Code:
echo '<form name="WA_eCart1_1_ATC_' $ID1 ' method="POST" action="' $_SERVER["PHP_SELF"]; 
echo (isset(
$_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:"" '">'
This code works and was automatically writern by my Shopping cart software, WA eCart. I based my code above on this code. I'm very confused about the way this code acts. Eg. If I put a line break between one of the many opening and closing php tags then the code stops working!
PHP Code:
<form name="WA_eCart1_1_ATC_<?php echo $row_workshopDATA["workshopDate_id"]; ?>
      " method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""?>">
        <input type="hidden" name="WA_eCart1_1_ID_Add" value="<?php echo $row_workshopDATA["workshopDate_id"]; ?>" />
        <select name="WA_eCart1_1_Quantity_Add">
        <option value="<?php echo $row_workshopDATA['workshop_maxParticipants']; ?>" selected><?php echo $row_workshopDATA['workshop_maxParticipants']; ?></option>
        </select>
        <input type="image" src="WA_eCart/Images/S1A_AddToCart.gif" border="0" value="Add To Cart" name="rb_eCart_3_ATC" />
      </form>