Hi everybody

Can some one help me out??

My problem is
I am using two forms in my asp page
form1 is used to upload photo, so I used enctype for it and action form1update.asp
and a submit button attached
when clicking on the submit button it should upload file using form1update.asp

form2 consists of 3 text boxes and submit button
action for form2 is form2update.asp
when clicking on submit button in form2, it should update all the details into database using form2update.asp

my problem is whenever i am clicking on upload button (submit button) in form1, instead of action form1update.asp, its going into form2update.asp
can u help me out on this!!!
thanks in advance

Can you post an example of the code that is being generated by asp?

I ran into this problem in C#.NET... we had to listen for and disable the enter key event... otherwise it always submitted the wrong form.. but clicking was ok.

cheers.

in asp and html forms the submit button submits the form that it (the submit button) is in.

you are probably using javascript to submit the form or your second form has a if submit then clause.

post the page for more assistance

I hate to jump in here, but I am having a very similar problem and thought maybe someone could, PLEASE, help. I have two forms. The first form is for for user login and has an onSubmit link to validate the fields. When the submit button is hit for this form, it uses the onSubmit link but then proceeds to use the action from the second form. This only happens if the second forms submit button has been used. Here is the code for the first form:

<form method="post" name="FrmLogin" onSubmit="return Validate_FrmLogin()"  action="<?php echo $CONST_LINK_ROOT?>/prglogin.php">
          <tr>
            <td align="left"><?php echo LOGIN_USERNAME?>
        </td>
          </tr>
          <tr>
            <td align="left"><input type="text" class="input" name="txtHandle" size="20" tabindex="1" value="<?=$HTTP_COOKIE_VARS[txtHandle_c]?>">
        </td>
          </tr>
          <tr>
            <td align="left"><?php echo LOGIN_PASSWORD ?>
        </td>
          </tr>
          <tr>
            <td align="left" class="tdeven" > <input name="txtPassword" type="password" class="input" tabindex="2" value="<?=$HTTP_COOKIE_VARS[txtPassword_c]?>" size="20">
        </td>
          </tr>
          <tr>
            <td align="left" class="tdodd"><?php echo LOGIN_LOG_AUTOMATICALY ?> 
                  <input type=checkbox name="save"<?php if(isset($HTTP_COOKIE_VARS[txtHandle_c])) echo ' checked' ?>> 
                </td>
          </tr>
          <tr > 
                <td colspan="1" align="left"> <input name="submit" type="submit" class="button"  value='<?= BUTTON_LOGIN ?>'> 
                </td>
              </tr>
        </form>

and, the code for the second form:

<form name="dating service" method="POST" action="prgminisearch.php">
          <tr>
        <td height="30" valign="top"><strong>Search for a Date...</strong>
        </td>
          </tr>
          <tr>
                <td class="smallest" height="20" valign="bottom"><strong>I am a</strong>
        </td>
              </tr>
              <tr>
                <td><select name="lstDatingFrom" size="1" class="inputf">
                  <option value='M' selected><?php echo GENDER_M?></option>
                  <option value='F'><?php echo GENDER_W?></option>
                  <option value='C'><?php echo GENDER_C?></option>
                  </select>
            </td>
              </tr>
              <tr>
                <td class="smallest" height="20" valign="bottom"><strong>Seeking a</strong>
            </td>
              </tr>
              <tr>
                <td class="smalltext"><select name="lstDatingTo" size="1" class="inputf">
                  <option value='M'><?php echo GENDER_M?></option>
                  <option value='F' selected><?php echo GENDER_W?></option>
                  <option value='C'><?php echo GENDER_C?></option>
                  </select>
        </td>
              </tr>
              <tr>
                <td class="smallest" height="20" valign="bottom"><strong>Located in</strong>
        </td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><select name="lstDatingCountry" class="inputf">
                  <option selected value="0">
                  <?=SEARCH_ALLCOUNTRIES?>
                  </option>
                  <?while ($country_row = mysql_fetch_object($country_res)){?>
                  <option value="<?=$country_row->gcn_countryid?>">
                  <?=$country_row->gcn_name?>
          </option>
                  <?}?>
                  </select>
        </td>
                <td><input type="image" src="images/go.gif" style="border:0px solid #ffffff;"  width="20" height="21" alt="dating service search" name="dating service search">
        </td>
          </tr>
        </form>

If anyone knows a way around this predicament, please help.

this is an asp forum i cant understand php.

ok why not put both forms fields on 1 forum? if you need the second form to retrieve a record from the first form put an if then statement

if form1=submit then
form 2
else
form 1
end if

to my knowledge you cant see if a form was submited so you add a url thing similar to "index.asp?login=true" the if is if the url login=true then

hope it helps if not let me know what you hope to achieve, dont expect any php code though

12345678910

12345678910

and the best answer to the problem goes to wchitamb.

i am sorry man what happened was when i did reply your thread i did an experiment myself and it was not the best solutions so i could't delete it so i just typed the numbers on top.

no hard feelings man!! SORRY ABOUT THAT.

Hi...
I have tried with my code... which have two forms..
the first form is to upload the page and second if we submit the form it displays the form entries...
Its working fine...
see each submit button have different events..
there is no confusion... unless otherwise it goes to different asp pages...

Thanks and Regards,
UmaParvathy G K

Be a part of the DaniWeb community

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