Jump to content

form question

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
7 replies to this topic

#1
techker

techker

    Programmer

  • Members
  • PipPipPipPip
  • 136 posts
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.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
You will get all the info. You have to use a server-side language to filter the information and react accordingly.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Guest_Jordan_*

Guest_Jordan_*
  • Guests
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
techker

techker

    Programmer

  • Members
  • PipPipPipPip
  • 136 posts
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
techker

techker

    Programmer

  • Members
  • PipPipPipPip
  • 136 posts
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.


<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
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
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.

#7
thomas73

thomas73

    Newbie

  • Members
  • Pip
  • 9 posts
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.

#8
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts

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.

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