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 November 25th, 2012, 07:28 AM
westie2506 westie2506 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 11 westie2506 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 3 m 45 sec
Reputation Power: 0
Send a message via MSN to westie2506 Send a message via Skype to westie2506
Other - Issues with forms

I have a form to a shopping cart that I am developing, that adds a product to the cart using standard HTML forms. To give some feedback I open a popup window using onsubmit, and opening a new window on top with the following code
Code:
function display_alert(p,c)
	{
	var h=260;
	var w=380;
	var left = (screen.width/2)-(w/2);
	var top = (screen.height/2)-(h/2);
	var targetWin = window.open("./alert.php?prod="+p+"&coll="+c, "_blank", "location=no, status=no, toolbar=no, menubar=no, directories=no, width="+w+", height="+h+", top="+top+", left="+left);
	}


Variable P is the product ID, and C is the collection (category) ID.

I also want to pass the quantity of products ordered to this function, HOWEVER the quantity is an HTML text box within the same form, called as so:

Code:
<input type="text" name="cart_quantity" value="0" maxlength="6" size="4" />


I have tried to use the PhP $_POST to read the data from the form, but it won't read the data - presumably as I am not directly submitting the data from the form to the alert.php file.

So the question is: how can I get this cart_quantity variable either into the URL data or passed to the alert.php file?

Any help would be appreciated.

Reply With Quote
  #2  
Old November 28th, 2012, 01:29 PM
web_loone08's Avatar
web_loone08 web_loone08 is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2008
Posts: 605 web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 16 h 34 m 55 sec
Reputation Power: 69
You mean something like this:

Code:
JavaScript
function display_alert(p,c)
	{
	var h=260;
	var w=380;
	var left = (screen.width/2)-(w/2);
	var top = (screen.height/2)-(h/2);
        var quantity = document.getElementById("cq").value;
	var targetWin = window.open("./alert.php?prod="+p+"&coll="+c+"&quantity="+quantity, "_blank", "location=no, status=no, toolbar=no, menubar=no, directories=no, width="+w+", height="+h+", top="+top+", left="+left);
	}


Code:
HTML
<form onsubmit="display_alert('0123','3210')">
<input id="cq" type="text" name="cart_quantity" value="0" maxlength="6" size="4" />
<input type="submit"/>
</form>

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Other - Issues with forms

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