php - How does form buttons can select checkboxes in the next page? -


i have buttons in first_page.php, , checkboxes in second_page.php.
need select corresponding checkbox query string this:
when "first value button" pressed --> "second_page.php" "my first value" checkbox selected.

first_page.php :

<form action="second_page.php"> <input class="btn" type="submit" value="first value button"> <input class="btn" type="submit" value="second value button"> <input class="btn" type="submit" value="third value button"> </form> 

second_page.php :

<form name="name" method="post" action="#">   <input type="checkbox" name="mybox[]" value="my first value"/>     <span>my first box</span><br />   <input type="checkbox" name="mybox[]" value="my second value"/>     <span>my second box</span><br />   <input type="checkbox" name="mybox[]" value="my third value"/>     <span>my third box</span><br /> </form> 

you have specify name each input connect $_post in second_page.php have fetch form value. in first_page.php:

<form action="second_page.php" method="post">     <input name="first_value_btn" class="btn" type="submit" value="first value button">     <input name="second_value_btn" class="btn" type="submit" value="second value button">     <input name="third_value_btn" class="btn" type="submit" value="third value button"> </form> 

in second_page.php :

<input type="checkbox" name="prodotti[]" value="my first value" <?php echo ( isset($_post['first_value_btn']) ? 'checked="checked"' : '');?> /> 

read more

i've used post method in example above, use get instead , replacing $_post $_get instead.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -