I tried in many ways to create an array using this form,but i can't find any that work. I need also to convert the array in a string so I can add this in the database. This is the code php
$Generea = isset($_POST['Genere']);
$Genere = implode(";", $Generea);
html
<fieldset>
<legend>Genere*:</legend>
<input type = "checkbox" value="Action" Name="Genere[]"/>Action
<input type = "checkbox" value="Platform" Name="Genere[]"/>Platform
<input type = "checkbox" value="Shooter" Name="Genere[]"/>Shooter
<input type = "checkbox" value="Fighting" Name="Genere[]"/>Fighting
<input type = "checkbox" value="Beat 'em ups" Name="Genere[]"/>Beat 'em ups<BR>
<input type = "checkbox" value="Stealth" Name="Genere[]"/>Stealth
<input type = "checkbox" value="Survival" Name="Genere[]"/>Survival
<input type = "checkbox" value="Adventure" Name="Genere[]"/>Adventure
<input type = "checkbox" value="Avventura testuale" Name="Genere[]"/>Avventura testuale
<input type = "checkbox" value="Avventura grafica"/ Name="Genere[]"/>Avventura grafica<BR>
<input type = "checkbox" value="RPG" Name="Genere[]"/>RPG
<input type = "checkbox" value="MMO" Name="Genere[]"/>MMO
<input type = "checkbox" value="Strategy" Name="Genere[]"/>Strategy
<input type = "checkbox" value="Sandbox" Name="Genere[]"/>Sandbox
<input type = "checkbox" value="Simulation" Name="Genere[]"/>Simulation<BR>
<input type = "checkbox" value="Sport" Name="Genere[]"/>Sport
<input type = "checkbox" value="Racing" Name="Genere[]"/>Racing
<input type = "checkbox" value="Music" Name="Genere[]"/>Music
<input type = "checkbox" value="Party" Name="Genere[]"/>Party
<input type = "checkbox" value="Horror" Name="Genere[]"/>Horror
</fieldset>
As Form method i use POST
You should be imploding the $_POST
variable, not the result of isset()
(which is just true
or false
).
if (isset($_POST['Genere']) {
$Genere = implode(';', $_POST['Genere']);
}