Jump to content

Javascript formating of for submittal


dennishall

Recommended Posts

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?

 

 

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.