JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 14th, 2006, 02:18 PM
robburne robburne is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 14 robburne User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 20 m 59 sec
Reputation Power: 0
HTML form and onlclick window.open

Hi,

I have a simple html form which when submitted I want to popup a new window which I can control the size of. Further, in the popup window I want to be able to access the form data.

This is what I have done so far......

Code:
Original - Code
    <form> <input type=text name=email size=27> <input class=button type="image" src="images/submit.jpg" onClick="window.open('send.php?subscribe=1', 'newWindow','width=300,height=150,'+'status=no,toolbar=no,menubar=no')"> </form>


When I submit the popup windows opens correctly and I am trying to access and output the two variables with php as follows:

Code:
Original - Code
    $email = $_POST["email"]; $subscribe = $_GET["subscribe"];            echo $email $subscribe;


Only the 'subscribe' variable which is passed in the url outputs correctly. [I]So my question is how do I accesss the variable input by the user into the form from the original page.[/I]

Many thanks in advance.

Rob.

Reply With Quote
  #2  
Old March 14th, 2006, 02:53 PM
Michael2003 Michael2003 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Dec 2003
Posts: 1,037 Michael2003 User rank is Sergeant (500 - 2000 Reputation Level)Michael2003 User rank is Sergeant (500 - 2000 Reputation Level)Michael2003 User rank is Sergeant (500 - 2000 Reputation Level)Michael2003 User rank is Sergeant (500 - 2000 Reputation Level)Michael2003 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 14 h 20 m 3 sec
Reputation Power: 25
1. Use the onsubmit event on the <form> instead of onclick on the <input>
2. Set the target of the form to newWindow.
3. Specify the method of the form to either GET or POST.

Reply With Quote
  #3  
Old March 14th, 2006, 05:10 PM
robburne robburne is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 14 robburne User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 20 m 59 sec
Reputation Power: 0
Thanks for the reply, this is what I have now:

Code:
Original - Code
    <form method="POST" target="newWindow" onSubmit="window.open('send.php?subscribe=1', 'newWindow','width=300,height=150,'+'status=no,toolbar=no,menubar=no')">                                 <input type=text name=email size=27>                                 <input class=button type="image" src="images/submit.jpg">                               </form>


Then on the popup I have this:

Code:
Original - Code
    $email = $_POST["email"]; $subscribe = $_POST["subscribe"];            echo $email $subscribe;


However when I submit the form all that happens is the pop up open with the original page and not the intended popup.

I am confused!

Thanks,

Rob.

Reply With Quote
  #4  
Old March 14th, 2006, 05:29 PM
Kravvitz's Avatar
Kravvitz Kravvitz is offline
CSS & JS/DOM Adept
Dev Shed God 30th Plane (19500 - 19999 posts)
 
Join Date: Jul 2004
Location: USA
Posts: 19,831 Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level) 
Time spent in forums: 6 Months 1 Day 19 h 36 m 53 sec
Reputation Power: 4192
You need to use the action attribute of form.

Code:
<form method="POST" action="send.php?subscribe=1" target="newWindow" onSubmit="window.open('', 'newWindow','width=300,height=150,'+'status=no,toolbar=no,menubar=no')">
__________________
Spreading knowledge, one newbie at a time. I'm available for hire at Dynamic Site Solutions.

Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

Remember people spend most of their time on other people's sites (so don't violate web design conventions).

Reply With Quote
  #5  
Old March 14th, 2006, 05:45 PM
robburne robburne is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 14 robburne User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 20 m 59 sec
Reputation Power: 0
Thanks guys, you're stars but it does not take me to telll you that!

I had been working on this for ages, all working great now.

Many thanks!

Rob.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > HTML form and onlclick window.open

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap