dprichard Posted April 12, 2006 Share Posted April 12, 2006 I am not sure what I am doing wrong here, but I am trying to make a form that changes based on the status of a gallery in my script. Here is the If statement, but I am getting the followin error:Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in D:\sitename\admin\admin-gallery-add-1.php on line 161Any help would be greatly appreciated. Thank you![code]<?php if ($row_galleries['gallery_status'] == 0) {echo "<input name="gallery_status" type="hidden" id="gallery_status" value="1"><input name="gallery_id" type="hidden" id="gallery_id" value="$row_galleries['gallery_id']"><input type="image" name="submit2" src="../images/icons/forbidden.png" width="16" height="16">"; } if ($row_galleries['gallery_status'] == 1) { echo '<input name="gallery_status" type="hidden" id="gallery_status" value="0"><input name="gallery_id" type="hidden" id="gallery_id" value="echo $row_galleries['gallery_id']"> <input type="image" name="submit2" src="../images/icons/add.png" width="16" height="16">'; } ?> [/code] Link to comment https://forums.phpfreaks.com/topic/7211-using-if-else-with-forms-and-variables/ Share on other sites More sharing options...
kenrbnsn Posted April 12, 2006 Share Posted April 12, 2006 Too many double quotes in this line:[code]<?phpecho "<input name="gallery_status" type="hidden" id="gallery_status" value="1"><input name="gallery_id" type="hidden" id="gallery_id" value="$row_galleries['gallery_id']"><input type="image" name="submit2" src="../images/icons/forbidden.png" width="16" height="16">";?>[/code]try[code]</phpecho '<input name="gallery_status" type="hidden" id="gallery_status" value="1"><input name="gallery_id" type="hidden" id="gallery_id" value="' . $row_galleries['gallery_id'] .'"><input type="image" name="submit2" src="../images/icons/forbidden.png" width="16" height="16">';?>[/code]You almost got it right with the second "echo", change it from:[code]<?phpecho '<input name="gallery_status" type="hidden" id="gallery_status" value="0"><input name="gallery_id" type="hidden" id="gallery_id" value="echo $row_galleries['gallery_id']"><input type="image" name="submit2" src="../images/icons/add.png" width="16" height="16">';?>[/code]to[code]<?phpecho '<input name="gallery_status" type="hidden" id="gallery_status" value="0"><input name="gallery_id" type="hidden" id="gallery_id" value="' . $row_galleries['gallery_id'] . '"><input type="image" name="submit2" src="../images/icons/add.png" width="16" height="16">';?>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/7211-using-if-else-with-forms-and-variables/#findComment-26249 Share on other sites More sharing options...
dprichard Posted April 12, 2006 Author Share Posted April 12, 2006 Thanks, that worked... Link to comment https://forums.phpfreaks.com/topic/7211-using-if-else-with-forms-and-variables/#findComment-26307 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.