Re: Page refresh question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I can think of 2 solutions:

1 is an old one I used ages ago, and it was to use javascript to put their 
choices (onclick, field.value=£3 type of thing) and when they click the OK 
button it gets sent to php script that sends it to mysql, etc.

2 is pretty much the same but using cookies with javascript.


Example : --


<script language="JavaScript">
<!-- Hide from old browsers
//Hide from Java Script

function cookieVal(cookieName) {
thisCookie = document.cookie.split("; ");
       for (i=0; i<thisCookie.length; i++) {
          if (cookieName == thisCookie[i].split("=")[0]) {
             return thisCookie[i].split("=")[1];
          }
        }
                   return 0;
                }

//-->
</script>

<script language="JavaScript">
<!-- Hide from old browsers
//Hide from Java Script

function SetCookie(value1,value2,value3){
var greetName = cookieVal("mysession");

if(greetName == 0){
document.cookie = "mysession" + "=" + value1 + ":" + value2 + ":" + value3 
+":1%" + "; path=/; expires=19 January 2038 03:14:07";
var addme= value +":1%";
}
else{
document.cookie = "mysession" + "=" + greetName + value1 + ":" + value2 + 
":" + value3 + ":1%" + "; path=/; expires=19 January 2038 03:14:07";
var addme = value +":1%";
}

theURL="http://www.domain.com/cgi-bin/showbasket.cgi?cookievalue="+addme;
winName="order3";
features="scrollbars=yes,width=400,height=600";

child = window.open(theURL,winName,features);
child.focus();

}

//-->
</script>
<a href="#"><img src="images/image1.jpg" alt="image1" width="80" hspace="5" 
vspace="3" border="0" 
onClick="javascript:SetCookie('555435,£3,image1');">"></a>Hope this helps.


Han.



----- Original Message ----- 
From: "Chris Payne" <cjp@xxxxxxxxxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Sent: Thursday, June 09, 2005 5:33 AM
Subject:  Page refresh question


> Hi there everyone,
>
>
>
> I'm using PHP and MySQL in a shopping cart system but the client wants it 
> so
> that when you add an item to the cart the page doesn't refresh and we all
> know with PHP the page MUST refresh in order to execute the MySQL query. 
> Is
> it possible, maybe with javascript? That I can talk to MySQL without 
> having
> to have the page itself refresh when they add the items to the cart?  This
> is really a pain as the system was basically finished and now I'm told 
> they
> don't want the page to refresh and they see other sites that don't 
> refresh -
> sigh.  If it can be done with Javascript, do you have a sample of how I 
> can
> use PHP, Javascript and MySQL together to achieve this please?
>
>
>
> Any help would not only be appreciated, but would save my life.
>
>
>
> Thank you.
>
>
>
> Chris
>
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




**********************************************************************

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.

************************************************************************
<<<<GWAVAsig>>>>
AdmID:2C0189DC9073A0C27125545E07598202



**********************************************************************

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use
of this communication or the information in it is strictly prohibited.
Piranha Studios Limited asserts its rights in this communication and
the information in it and reserves the right to take action against
anyone who misuses it or the information in it.

Piranha Studios Limited cannot accept any liability sustained as a
result of software viruses and would recommend that you carry out your
own virus checks before opening any attachment.

************************************************************************
<<<<GWAVAsig>>>>
AdmID:60CDEC1C11049489B404EE8844010E45

AdmID:5730125FA2D2EB0AF3BF336FEE701BF5

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux