hey guys im trying to do a form that has a 8 select boxes and 8 checkboxe's.
as is
drop down select checkbox
drop down select checkbox
drop down select checkbox
drop down select checkbox
drop down select checkbox
drop down select checkbox
drop down select checkbox
so i want it that when the client checks one box when he submits the form a page X will retreive only the info from the select and the box that was selected.
i cant seem to get only the info of the check box and select that was selected..i get all the info.
form question
Started by techker, Feb 19 2009 09:30 AM
7 replies to this topic
#1
Posted 19 February 2009 - 09:30 AM
|
|
|
#2
Posted 19 February 2009 - 12:01 PM
You will get all the info. You have to use a server-side language to filter the information and react accordingly.
#3
Guest_Jordan_*
Posted 19 February 2009 - 12:04 PM
Guest_Jordan_*
I'm not sure I understand, do you want a checkbox or drop-down select box? You state both. If you have multiple checkboxes. Perhaps what you are looking for is "radio" where only one choice can be selected? Forms : Radio Button - HTML Tutorial
#4
Posted 19 February 2009 - 12:10 PM
i got this working
<?
$query = "SELECT pic FROM ABS";
$result = mysql_query($query);
print "<SELECT name=ABSpic onchange=\"reload(this.form)\"><option value=''>$cat</option>";
while ($line = mysql_fetch_array($result))
{
foreach ($line as $value)
{
print "<OPTION value='$value'";
}
print ">$value</OPTION>";
}
mysql_close($link);
print "</SELECT>";
$cat=$HTTP_GET_VARS['ABSpic'];
echo "<input type=checkbox name='ABS1' value='$cat'>";
?>
#5
Posted 19 February 2009 - 12:28 PM
if i multiply it and change the variables lets say cat2 cat3,cat4..
its the java part that makes it not work correctly .it refreses but does not show the selected.
its the java part that makes it not work correctly .it refreses but does not show the selected.
<SCRIPT language=JavaScript>
function reload(form)
{
var val=form.ABSpic.options[form.ABSpic.options.selectedIndex].value;
self.location='self.php?_id=<? print"$client_id"?>&cat=' + val ;
}
</script>
#6
Posted 19 February 2009 - 01:08 PM
as I understand it:
he wants 8 lines with a dropdown and a checkbox on each line.
when something is choosen from the first dropdown, the page should load what to show in the next dropdown, and show the previous choosen result in the first one, and so on up to 8 dropdowns.
he wants 8 lines with a dropdown and a checkbox on each line.
when something is choosen from the first dropdown, the page should load what to show in the next dropdown, and show the previous choosen result in the first one, and so on up to 8 dropdowns.
#7
Posted 26 February 2009 - 02:09 AM
If you refresh the page you have to insert also the values that has been selected before in the url. After you got these values you have to set them into the option value as "selected".
If you are familiar I recomend you to use ajax so not the whole page will make a refresh (in this case 8 times will be annoying) only the next listbox will be loaded and the selected one will not change and stay as selected.
If you are familiar I recomend you to use ajax so not the whole page will make a refresh (in this case 8 times will be annoying) only the next listbox will be loaded and the selected one will not change and stay as selected.
#8
Posted 26 February 2009 - 02:48 PM
thomas73 said:
If you refresh the page you have to insert also the values that has been selected before in the url. After you got these values you have to set them into the option value as "selected".
If you are familiar I recomend you to use ajax so not the whole page will make a refresh (in this case 8 times will be annoying) only the next listbox will be loaded and the selected one will not change and stay as selected.
If you are familiar I recomend you to use ajax so not the whole page will make a refresh (in this case 8 times will be annoying) only the next listbox will be loaded and the selected one will not change and stay as selected.
That is not the way to do it, as the refresh he is talking about, really is a reload (unless you do it the AJAX way). You should get the php code to set the selected value properly into the gererated html.
you do this by setting the value="" attribute in an input or add an selected="selected" attribute to the other controls.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall


Sign In
Create Account


Back to top









