I want submit the value of the checkbox but the value have 2 words "Blue car". I am only receiving the first word. How can I receive both?
<form action="" method="post">
<?php
$carname1 = "Blue car";
$carname2 = "Red car";
$carname3 = "Black car";
echo "<input type='checkbox' id='classe' name='car[]' value=$carname1><label for=$carname1>$carname1</label><br>";
echo "<input type='checkbox' id='classe' name='car[]' value=$carname2><label for=$carname2>$carname2</label><br>";
echo "<input type='checkbox' id='classe' name='car[]' value=$carname3><label for=$carname3>$carname3</label><br>";
?>
<input type="submit" name="submit" value="Atualizar">
<?php
if (isset($_POST["submit"])){
$newclasse = $_POST["car"];
print_r($newclasse);
}
?>
The result is :
Array ( [0] => Blue [1] => Red )
I would like to receive the "Blue Car"... etc...
Aucun commentaire:
Enregistrer un commentaire