Jump to content

Archived

This topic is now archived and is closed to further replies.

cameeob2003

Multi functions in one form

Recommended Posts

I am trying to make the basic form as shown below:

[code]<form method="post" name="signup" action="code/subscribe.php" style="margin-top: 0px; margin-bottom: 0px;">
<tr valign="top">
<td colspan="2">
<img src="images/index_26.gif" width="45" height="17" alt=""></td>
<td colspan="6" valign="top">
<input name="email" type="text" style="background-image:images/index_27.gif; width:139px; height:17px; border:none; margin-top: 0px; margin-bottom: 0px;" border="0" align="top" height="16" width="139">
</td>
<td colspan="2">
<img src="images/index_28.gif" width="10" height="17" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="17" alt=""></td>
</tr>
<tr>
<td colspan="10">
<img src="images/index_29.gif" width="194" height="5" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="5" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/index_30.gif" width="50" height="16" alt=""></td>
<td valign="top">
<input type="button" align="top" vspace="0" border="0" style="background:url(images/index_31.gif); width:67px; height:16px; border:0px; margin-top: 0px; margin-bottom: 0px;" width="67" height="16">
</td>
<td>
<img src="images/index_32.gif" width="6" height="16" alt=""></td>
<td colspan="2" valign="top">
<input type="button" align="top" vspace="0" border="0" style="background:url(images/index_33.gif); width:58px; height:16px; border:0px; margin-top: 0px; margin-bottom: 0px;" width="58" height="16">
</td>
<td colspan="3">
<img src="images/index_34.gif" width="13" height="16" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="16" alt=""></td>
</tr>
</form>[/code]

I want one of the inputs to grab the information from the email input and add it to my mysql database. I want the other to delete the email from my database. I have the PHP side of things done but dont know how to add this to multi-function to my HTML form. Any help would be great.

Share this post


Link to post
Share on other sites
I assumed these are the 2 buttons for the functions?
[code]
<input type="button" align="top" vspace="0" border="0" style="background:url(images/index_31.gif); width:67px; height:16px; border:0px; margin-top: 0px; margin-bottom: 0px;" width="67" height="16">

<input type="button" align="top" vspace="0" border="0" style="background:url(images/index_33.gif); width:58px; height:16px; border:0px; margin-top: 0px; margin-bottom: 0px;" width="58" height="16">
[/code]

well just change these 2 to something like this:
[code]
<input type="submit" name="option1" align="top" vspace="0" border="0" style="background:url(images/index_31.gif); width:67px; height:16px; border:0px; margin-top: 0px; margin-bottom: 0px;" width="67" height="16">

<input type="submit" name="option2" align="top" vspace="0" border="0" style="background:url(images/index_33.gif); width:58px; height:16px; border:0px; margin-top: 0px; margin-bottom: 0px;" width="58" height="16">
[/code]
then put this at the start of the php stuff

if(isset($_POST['option1'])){
    // OPTION 1 - DO THIS
} else if(isset($_POST['option2'])){
    // OPTION 2 - DO THIS
}

Share this post


Link to post
Share on other sites

×

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.