November 15, 201312 yr Hi all, Im having some trouble building a form and wondered if anyone could help. I have a form which has got multiple checkboxes and what im trying to do is make the form action a variable which directs one way if the checkboxes have been checked and another if there empty. ( I should point out that the php code is in another file that is being included in the header of each page ) The code I currently have is: <form class="indexSearch" action="<php echo $indexSearchFormAction; ?>" method="get"> <ul class="indexSearchIndustryList"> <li> <input type="checkbox" value="1" name="industryList[]"><a href="#">Bathroom Fitting</a> </li> <li> <input type="checkbox" value="2" name="industryList[]"><a href="#">Bricklaying</a> </li> <li> <input type="checkbox" value="3" name="industryList[]"><a href="#">Carpentry</a> </li> <input type="submit" value="Show results" name="indexSearchSubmit"> </form> <?php if (!isset($_GET['indexSearchSubmit'])) { $indexSearchFormAction = ""; } else { $indexSearchFormAction = "search.php"; } ?> when i submit i get the error: You don't have permission to access /training_and_apprenticeships/<php echo $indexSearchFormAction; on this server. any ideas what im doing wrong?
November 15, 201312 yr Author O my god lol 3 hours of tweaking and reading around for a question mark. I shall unregister myself immediately lol. Thanks
November 15, 201312 yr Its no problem mate, ive spent hours myself looking over a problem only to notice it was a missing ; or i have used /'/' in a string rather then \'\'
November 15, 201312 yr O my god lol 3 hours of tweaking and reading around for a question mark. I shall unregister myself immediately lol. Thanks Just a small tip a decent PHP editor will pick up these type of errors on the fly as u code something like netbeans
Create an account or sign in to comment