Jump to content

multiple form submits


col_edinburgh

Recommended Posts

have a form with three list/menu items. Each one when selected acts a filter. I would like to submit the form when the user changes the value on each list.menu: I have tried adding an onchange="this.form.submit()" command on each list/menu but only the first one works. I guess the form only recognises one submit item.

 

Is there a way to get the form to submit on each of the three list/menu items ?

 

Many thanks,

 

 

code ...

 

<body>

<form id="form1" name="form1" method="post" action="">

  <label>Team

    <select name="myTeam" id="myTeam" onchange="this.form.submit()">

      <?php

do {

?>

      <option value="<?php echo $row_myTeam['title']?>"<?php if (!(strcmp($row_myTeam['title'], $_POST['myTeam']))) {echo "selected=\"selected\"";} ?>><?php echo $row_myTeam['title']?></option>

      <?php

} while ($row_myTeam = mysql_fetch_assoc($myTeam));

  $rows = mysql_num_rows($myTeam);

  if($rows > 0) {

      mysql_data_seek($myTeam, 0);

  $row_myTeam = mysql_fetch_assoc($myTeam);

  }

?>

    </select>

  </label>

  <label>Qct

    <select name="myQCT" id="myQCT" onchange="this.form.submit()">

      <?php

do {

?>

      <option value="<?php echo $row_chooseQCT['name']?>"<?php if (!(strcmp($row_chooseQCT['name'], $_POST['myQCT']))) {echo "selected=\"selected\"";} ?>><?php echo $row_chooseQCT['name']?></option>

      <?php

} while ($row_chooseQCT = mysql_fetch_assoc($chooseQCT));

  $rows = mysql_num_rows($chooseQCT);

  if($rows > 0) {

      mysql_data_seek($chooseQCT, 0);

  $row_chooseQCT = mysql_fetch_assoc($chooseQCT);

  }

?>

    </select>

  </label>

  <label>Year

    <select name="myYear" id="myYear" onchange="this.form.submit()">

      <?php

do {

?>

      <option value="<?php echo $row_myYear['year']?>"<?php if (!(strcmp($row_myYear['year'], $_POST['myYear']))) {echo "selected=\"selected\"";} ?>><?php echo $row_myYear['year']?></option>

      <?php

} while ($row_myYear = mysql_fetch_assoc($myYear));

  $rows = mysql_num_rows($myYear);

  if($rows > 0) {

      mysql_data_seek($myYear, 0);

  $row_myYear = mysql_fetch_assoc($myYear);

  }

?>

    </select>

  </label>

</form>

</body>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.