Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

making form action a variable

Featured Replies

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?

 

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 \'\' :p

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.