I have this idea of a page i want to create but i really don't know how i would implement it . I want to create a page with some pictures and below each picture there would be a check box , i want people to be able to select the check box click next and when they are at the next page the item they checked would automatically be in a dropdown list .

Recommended Answers

what is your server scripting language. php, perl-cgi, asp.net, java or any other.

Jump to Post

What did you try yet?
In PHP, you can access GET variables (if you used method=get in your form) in the superglobal $_GET, and the POST variables (if method=post) in $_POST. For example, if you have a checkbox with name=someCheckbox, $_GET (or post, but get is probably better in this …

Jump to Post

All 6 Replies

Rather I want to create a page with some pictures and below each picture there would be a check box , i want people to be able to select the check box click next and when they are at the next page the name of the item they checked would automatically be displayed . something similar to what happens here http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_CHECKBOX.html when you select either onions or mushrooms and click submit

what is your server scripting language. php, perl-cgi, asp.net, java or any other.

Hi urtevedi , PHP is what i would like to use for this . I would be very grateful if you could help out.

What did you try yet?
In PHP, you can access GET variables (if you used method=get in your form) in the superglobal $_GET, and the POST variables (if method=post) in $_POST. For example, if you have a checkbox with name=someCheckbox, $_GET (or post, but get is probably better in this case, as you're not putting anything in a database) will be 'on' or '' (checked or not). Hope that helps.

your first html page

<form name=frm id=frm method=post action=showselected.php>
<img src='imga.jpg' ><checkbox name=chk id=chk value='imga.jpg'><br>
<img src='imgb.jpg' ><checkbox name=chk id=chk value='imgb.jpg'><br>
<img src='imgc.jpg' ><checkbox name=chk id=chk value='imgc.jpg'><br>
<img src='imgd.jpg' ><checkbox name=chk id=chk value='imgd.jpg'><br>
<img src='imge.jpg' ><checkbox name=chk id=chk value='imge.jpg'><br>

<input type=submit value=submit>
</form>

showselected.php

<?php
   $selcount=count($_POST['chk']);
   echo "YOu have selected following $selcount images:<br>";
   for($i=0;$i<$selcount;$i++)
   {
       echo $_POST['chk'][$i]."<br>";
   }
?>

I think it can be easy using javaScript:-/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.