Jump to content


Photo

Form with 2 submits


  • Please log in to reply
1 reply to this topic

#1 russia5

russia5
  • Members
  • PipPipPip
  • Advanced Member
  • 94 posts

Posted 08 September 2006 - 10:11 PM

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.

<!--
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>

My question is, what are my PHP variables.

I tryed email and frmsub:

Here is what I put in my preprocessor.php


<?php 



$email = $_POST(email);

echo($email);


?>

[b]I also tryed[/b]

<?php 



$frmsub = $_POST(frmsub);

echo($frmsub);


?>







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




#2 radalin

radalin
  • Members
  • PipPipPip
  • Advanced Member
  • 179 posts

Posted 09 September 2006 - 12:20 AM

try $_POST['email'] instead of $_POST(email)
Roy Simkes
Yet Another Parkyeri Developer




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users