dennishall Posted November 17, 2009 Share Posted November 17, 2009 I am using javascript to format a popup after a user inputs their email and clicks submit. The javascript works fine to format the window, however, the input value of email does not get passed to MySQL when I use the javascript. Here is the javascript in the header of index.php: <script type="text/javascript"> <!-- function PopupCenter(pageURL, title,w,h) { var left = (screen.width/2)-(w/2); var top = (screen.height/2)-(h/2); var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=auto, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left); } //--> </script> Here is the form in the body of index.php: <form method="post" action="confirm_e.php" target="_blank" name="newsletter_form" style="width: 174px; text-align:center"> Subscribe to our newsletters: <br/> <input name="em" size="15"/> <input value="Subscribe!" align="bottom" type="image" name="subscribe" src="images/mail_forward.png" width="25" onClick="PopupCenter('confirm_e.php', 'Thanks for subscribing',500,300);/></form> I must use confirm_e.php as the form processor to write to MySQL, however, the only way the javascript works is if I place it in the "subscribe" input tag (as seen above). All of this works without the onClick...(call to javascript) in the subscribe input tag but with the onClick..., the value of em is not passed to the confirm_e.php page and mMySQL gets a blank record written. Can anyone help me understand how to have the value of em get passed to the confirm_e.php page? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.