I am trying to put the following into a php block so i can reuse it in other webpages but i'm getting way too many errors.
can somebody please tell me how i can achieve this?
block of code inside php file:
<select name="products">
<option value="select">Select</option>
<option value="Box" <?php echo @$product_list['Box'] ?>>Box</option>
<option value="TV" <?php echo @$product_list['TV'] ?>>TV</option>
<option value="Setup" <?php echo @$product_list['Setup'] ?>>Setup</option>
</select>
I need the above code echoed inside the html page.
Thanks!
I just tried the heredoc syntax which doesn't appear to work which must mean i'm doing something wrong sigh
EDIT:
Any idea why i would get the following error for the code below: syntax error, unexpected T_IF
echo '<select name="products">
<option value="select">Select</option>
<option value="Box" '.
if (!isset($updatebtn_clicked)){
echo @$product_list['Box'];
}elseif (isset($updatebtn_clicked)){
echo @$_POST['Box'];
}
.'>'. $product_name[0] .'</option>
<option value="select">Select</option>
<option value="TV" '.
if (!isset($updatebtn_clicked)){
echo @$product_list['TV'];
}elseif (isset($updatebtn_clicked)){
echo @$_POST['TV'];
}
.'>'. $product_name[1] .'</option>
</select>;