Hi all

I have a checkboxes form. How can I get the results displayed (in a new window lets say) when submiting it?

Thank you

P.S. I care about getting results displayed part.

Well, when you submit the form, only the selected checkboxes will be posted to the next page. You can see what values are being posted by using print_r($_POST['checkboxname'] You can loop through $_POST (since that will be an array of checked values) and display the data however you want !

This is asample of my code:

$home='unchecked';
$home2='unchecked';

if (isset($_POST['submit'])) {
if (isset($_POST['home'])) {
$home = $_POST['home'];
if ($home == 'home') {$home = 'checked';}}

I add

echo "$home";
echo"home2";

But the echo I get if i check only 'home' is: on unchecked

What sould I change to display only the checked checkboxes end with their name (home, home2, etc.).

I first tried what you said but I got nothing.

[The same as I get in my db... (but here is no problem)]

Is too long cause i don't have only 3 boxes.

Is just like I show above including my db connection.

STARTS LIKE I JUST POSTED [$home='unchecked';] etc
AND ENDS WITH MY ECHO.

Nothing else.

I don't get it. Here is a simple example.

<?php
if(isset($_POST['submit'])) {
	print_r($_POST['check']);
}
?>
<html>
<body>
<form method="post" action="checkbox.php">
<input type="checkbox" name="check[]" value="1"> 1 <br />
<input type="checkbox" name="check[]" value="2"> 2 <br />
<input type="checkbox" name="check[]" value="3"> 3 <br />
<input type="checkbox" name="check[]" value="4"> 4 <br />
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

Oh.. was playing with procces.php and not the form.... I will give it a try

my next idea was

to replace

$home='unchecked';
with
$home='';

and

$home = 'checked';
with
$home = 'home';

Still no resaults with your way..

with mine replacing $home='unchecked';
with $home='';

I don't get desplayed anything when not checked. so i am ok here.

but still when is checked i get the word on..

hat do I have to change in order to get the word home or whatever i wand to get????

This question has already been answered. Start a new discussion instead.