Jump to content

Form with 2 submits


russia5

Recommended Posts

Hello, I have a form with two submits.  One is to subscribe to a newsletter and one is to unsubscribe.  I know shamefully little about Javascript.  Here is the form code and javascript.

[code]
<!--
function fnsubscribe() {
frm = document.getElementById('frmsub');
if (!ValidateEmailE(frm.email.value)) { frm.email.focus(); return false;}
frm.funcml.value = 'add';
frm.action = 'http://www.mysite.com/preprocessor.php';
frm.submit();
}
function fnUNsubscribe() {
frm = document.getElementById('frmsub');
if (!ValidateEmailE(frm.email.value)) { frm.email.focus(); return false;}
frm.funcml.value = 'unsub2';
frm.action = 'http://www.mysite.com/preprocessor.php';
frm.submit();
}
// -->
</script>
<!--form name="frmsearch" method="post" action="<?=$search_path?>search.php"-->
<table width="765" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="../images/bg1.gif"><img src="../images/cut1.jpg" width="151" height="90"><img src="../images/cut2.jpg" width="156" height="90"><img src="../images/cut3.jpg" width="149" height="90"><img src="../images/cut4.jpg" width="148" height="90"><img src="../images/cut5.jpg" width="146" height="90"></td>
<td background="bg.gif">&nbsp;</td>
</tr>
<tr valign="top">
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" background="../images/bluebg1.gif"><img src="../images/cut7a.jpg" width="151" height="24"><img src="../images/cut7.jpg" width="156" height="24">
</td>
<!-- <td colspan="2" valign="top" background="../images/bluebg1.gif">-->
<td colspan="0" valign="top" background="../images/bluebg1.gif">
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/bluebg.gif">
<tr>
<td>
<img src="../images/xxx.gif" width="184" height="14">
</td>
<td>
<form action="" method="post" name="frmsub" id="frmsub">
<input name="email" type="text" class="style" id="email">
<input name="funcml" type="hidden" value="">
<input name="p" type="hidden" id="p" value="8">
<input type="hidden" name="nlbox[1]" value="1">
</form> </td>
<td width="9%">
<a href="javascript:void fnsubscribe();"><img src="../images/arrow.gif" width="32" height="20" border="0"> </a>
</td>
<td>
<a href="javascript:void fnUNsubscribe();"><img src="../images/unsubscribe.gif" width="73" height="20" border="0">
</a>
</td>
</tr>
</table>
[/code]

My question is, what are my PHP variables.

I tryed email and frmsub:

Here is what I put in my preprocessor.php

[code]

<?php



$email = $_POST(email);

echo($email);


?>

[b]I also tryed[/b]

<?php



$frmsub = $_POST(frmsub);

echo($frmsub);


?>





[/code]


And here is my error I got on both of them:

Fatal error: Call to undefined function: array() in /home/russia5/public_html/box.php on line 5

$frmsub is indeed an array, but $email is single variable.

Again, I am looking for the php variables to place in preprocessor.php and I am looking for an answer to why I am getting the array. 

Thanks to all that take their time to help me.  Greg


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.