Jump to content

One form two actions


cameeob2003

Recommended Posts

I have the following code I am trying to work with:

[code]<form method="post" action="act.php" name="form1">
                <tr>
                  <td><table width="13" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td width="13"><img src="images/index_15.gif" width="45" height="17" alt=""></td>
<td><input type="text" name="email" value="" style="background:url(images/index_16.gif); width:139px; height:13px; border:none; font-size:9px;" /></td>
<td><img src="images/index_17.gif" width="17" height="17" alt=""></td>
                      </tr>
                    </table></td>
                </tr>
                <tr>
                  <td><table width="194" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td width="185"><img src="images/index_18.gif" width="201" height="5" alt=""></td>
                      </tr>
                    </table></td>
                </tr>
                <tr>
                  <td><table width="188" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td width="44"><img src="images/index_19.gif" width="50" height="16" alt=""></td>
                        <td width="136"><input type="submit" name="subscribe" value="" style="background:url(images/index_20.gif); width:58px; height:16px; border:none;" /></td>
                        <td width="10"><img src="images/index_21.gif" width="7" height="16" alt=""></td>
                        <td width="17"><input type="submit" name="unsubscribe" value="" style="background:url(images/index_22.gif); width:66px; height:16px; border:none;" /></td>
<td><img src="images/index_23.gif" width="20" height="16" alt=""></td>
                     
                    </table></td>
                </tr>
</form>[/code]

I want this part:

[code]<form method="post" action="act.php" name="form1">
                <tr>
                  <td><table width="13" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td width="13"><img src="images/index_15.gif" width="45" height="17" alt=""></td>
<td><input type="text" name="email" value="" style="background:url(images/index_16.gif); width:139px; height:13px; border:none; font-size:9px;" /></td>
<td><img src="images/index_17.gif" width="17" height="17" alt=""></td>
                      </tr>
                    </table></td>
                </tr>
                <tr>
                  <td><table width="194" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td width="185"><img src="images/index_18.gif" width="201" height="5" alt=""></td>
                      </tr>
                    </table></td>
                </tr>
                <tr>
                  <td><table width="188" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td width="44"><img src="images/index_19.gif" width="50" height="16" alt=""></td>
                        <td width="136"><input type="submit" name="subscribe" value="" style="background:url(images/index_20.gif); width:58px; height:16px; border:none;" onClick="document.theform.action='?act=subscribe';" /></td>[/code]

to access one form. While this code:

[code]<td width="17"><input type="submit" name="unsubscribe" value="" style="background:url(images/index_22.gif); width:66px; height:16px; border:none;" onClick="document.theform.action='?act=unsubscribe;" /></td>
<td><img src="images/index_23.gif" width="20" height="16" alt=""></td>
                     
                    </table></td>
                </tr>
</form>[/code]

Accesses and is processed through another php page upon submition.
I know this can be done through javascript but is there an easier way since I have no knowledge of javascript seeing how I am still learning php. Any help would be great.

Also if I give 2 forms the same name="" value will they submit to the same form and be processed at the same time?
Link to comment
Share on other sites

I wanted to do that but it is hard to because it messes up my image layout if I dont place the <form></form> outside of the <tr></tr> tags. I realy need to know If I can wrap each <input> with <form></form> tags individually and set the name the same on 2 of the form tags will it pick up that the 2 forms are meant to be one?
Link to comment
Share on other sites

Well it is quite easy if you had all the content on the same page and weren't trying to use two separate php pages, because you can use isset() :

[code]
<php
if(isset($_POST['subscribe'])){
//all of the php for subscribing
}
if(isset($_POST['unsubscribe'])){
//all of the php for unsubscribing
}
?>
[/code]

If it is possible to do that, it will be far easier, otherwise you are going to have to pass all of the form input to the othe php page, either by get or by post using cURL.

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.