Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

51 users online



looping checkbox values..

looping checkbox values..

Currently viewing this thread: 1 (0 members and 1 guests)


RUFiO57

RUFiO57

Status: Offline!

looping checkbox values..

i have a form which has checkboxes. it looks something like:

<form action="../queries/entrymanage.php" method="POST">
<input type="checkbox" name="checkbox" value="1'">
<input type="checkbox" name="checkbox" value="2">
<input type="checkbox" name="checkbox" value="3">
<input type="submit" name="Submit" value="show selected">
</form>

and i'm having trouble figuring out how to loop the values of the "checked" checkboxes on the entrymanage.php page. yeah.. alright. any help is appreciated.

BigToach

BigToach

Neversidian
Status: Offline!

is this what you mean?
<form action="../queries/entrymanage.php" method="POST">
<?php
for($i=1$i<4;$i++){
echo '<input type="checkbox" name="checkbox[]" value="'.$i.'">';
}
?>
<input type="submit" name="Submit" value="show selected">
</form>

___________________

Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!

vvuiverine

vvuiverine

Status: Offline!

here is an example of what I think you are asking:

page1:

Code:


<form name="theform" method="post" action="page2.html">
<input type="checkbox" name="val[]" value="line1">line1
<input type="checkbox" name="val[]" value="line2">line2
<input type="checkbox" name="val[]" value="line3">line3
<input type="checkbox" name="val[]" value="line4">line4
<br><br>
<input type="submit" name="submit" value="submit">

page2.html:

PHP:

<?php

foreach($_POST['val'] as $selected) {
    echo(
$selected);
}

?>

RUFiO57

RUFiO57

Status: Offline!

thank you BigToach and vvuiverine, i have it working now

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0075 seconds.