|
You can add/update/delete any type of variable at anytime when you use php sessions.
Here's a general take at what I'd do for an e-cart app. Firstly, I'd place all e-cart code
in a separate file, that way you can include it in any file you want. (even better, you can make
a class for it)
include_ecart.php:
(not checked for errors)
<br />
<?php<br />
<br />
function does_ecart_exist()<br />
{<br />
return (isset($_SESSION['ecart']));<br />
}<br />
<br />
function is_item_in_ecart($product_id)<br />
{<br />
if (!does_ecart_exist())<br />
return (false);<br />
<br />
return (isset($_SESSION['ecart'][$product_id]));<br />
}<br />
<br />
function add_item_to_ecart($product_id, $product_name, $unit_price, $quantity)<br />
{<br />
if (!does_ecart_exist())<br />
return (false);<br />
<br />
<br />
$product_data = array('name' => $product_name, 'price' => $unit_price, 'quantity' => $quantity);<br />
<br />
$_SESSION['ecart'][$product_id] = $product_data;<br />
<br />
return (true);<br />
}<br />
<br />
function view_ecart_contents()<br />
{<br />
if (!does_ecart_exist())<br />
return (false);<br />
<br />
$product_id = 0;<br />
$product_data = array();<br />
<br />
while (list($product_id, $product_data) = each($_SESSION['ecart']))<br />
{<br />
printf('Product Id: %1$s, Name: %2$s, Price: %3$s, Quantity: %4$s', <br />
$product_id,<br />
$product_data['name'],<br />
$product_data['price'],<br />
$product_data['quantity']);<br />
}<br />
<br />
return (true);<br />
}<br />
<br />
function remove_item_from_ecart($product_id)<br />
{<br />
if (!does_ecart_exist())<br />
return (false);<br />
<br />
if (!is_item_in_ecart($product_id))<br />
return (false);<br />
<br />
$_SESSION['ecart'][$product_id] = array();<br />
unset($_SESSION['ecart'][$product_id]);<br />
<br />
return (true);<br />
}<br />
<br />
function check_out_ecart()<br />
{<br />
}<br />
<br />
<br />
session_start();<br />
<br />
if (!is_ecart_exists())<br />
$_SESSION['ecart'] = array();<br />
?><br />
<br />
Now, all you have to do is add:
include_once("include_ecart.php");
to the top of each file that will use the e-cart, and you've got access to all the e-cart functions and session data. For adding an item, all you'd have to do is call add_item_to_cart after the user post/button click occurs:
add_product_to_ecart(1, "Product No1", "5.00", "1");
Removing an item, just call:
remove_product_from_ecart(1);
You should check and see if there's an existing e-cart php class somewhere on the net. I know PEAR has lots of good classes in it, but I can't say for sure if it has any e-cart functionality.
Pssst. You see that little light on your monitor? That's actually a spy camera, and I'm tracking your every move...
|
|
|
|
|
i have a html page which uses codepage-1256 for its character set but i have a problem when i type some letters in Farsi my server can not recognize them but when i copy and paste these letters from the page itself it works ...
what is my problem...?
|
|
|
|
|
"my server can not recongnize"?
what do you mean?
Thinking-Asking-Thinking
|
|
|
|
|
i mean the server or application which should reply to my request can not recognize the characters and it descards all the characters..
think that i type "H" ,this is a valid character but server or application which replies to my request can not get it as a valid entry,but when i copy and paste the character "H" from the page itself ,it works....
|
|
|
|
|
Hi friends,
My java applet(Newsscroll) hides the dyanamic dropdown menus.
Is there a way to unhide them?
Ranjan
|
|
|
|
|
I have to list some information at my asp page.I get the info from a access database.I want to list the info rows 10 by 10 in every page.
Would somenone send me a sample paging source code.
--jcalone--
|
|
|
|
|
|
|
<A href="..\claimsp\submitclaim1.aspx">Claims Processing</A><br>
i am trying to add ?name=Session["name"] into this href and i have tried
<A href="..\claimsp\submitclaim1.aspx?name"<%=Session["name"]%>>Claims Processing</A><br>
but is does not work can somebody help me
chad
|
|
|
|
|
i didn't try but did u try this :
>Claims Processing
note the = after the ?name
HTH
"Rejoice always, pray without ceasing, in everything give thanks; for this is the will of God in Christ Jesus for you."1Thess. 5:16-18
|
|
|
|
|
|
Hi Friends,
My interest area is Software Engineering and Web related technologies.
My Knowledge base is surely SHALLOW.
As far as my education is concerned:
Did B.Sc in 1991 and after 10 years again started my education.
Different professional software diploma courses attended with student
level projects.
Currently, I am working as a web developer(PHP,MYSQL) for the last 9
months in a small company in India in which we do not apply Software
Engineering Practices.
e.g We do not design an E-R diagram on paper means no relationship is defined between different entities.No one uses the term E-R Here.Complete specs of the project are rarely available.As per given specs project is delivered and when feedback from client comes changes are made accordingly,I may have to change database.
Already 9-10 american sites working and doing (MCA) as a part time
student in a open university.
Some people say that There is no benefit of doing MCA if my interest
area is Web Development.
Goal is to get job satisfaction and make money.
Please advise me that what my approach should be.
High Regards,
Ranjan Goyal
|
|
|
|
|
I dont agree with ppl who say MCA is not benificial.
Also, MCA will definitely help you in Software Engineering and Web related technologies, which as you are your interests. If I were you, i'd take it up
HTH
"Rejoice always, pray without ceasing, in everything give thanks; for this is the will of God in Christ Jesus for you."1Thess. 5:16-18
|
|
|
|
|
Hi rohan,
Thanks for your response.
Below I am giving a small outline of two projects which I did at student level.Please read.
Member of SRS team in the Software Engineering (SENG) module. I created Data Flow Diagrams, Data Dictionary, Work Breakdown Structure, State Transition Diagram and Design Document. Design was implemented using ASP, COM, VB and MS-SQL Server.
Team Size: 9
Designed a Rapid Action Development tool using UML at NCST as part of Object Oriented Analysis and Design module (OOAD). Use Case Diagram, Collaboration Diagrams, Class Diagram and Sequence Diagrams.
Team Size: 4
In view of above do you still think that I should do MCA.
How this degree will help me to be considered as a serious professional?
Please elaborate for my understanding.
Regards,
Ranjan Goyal
(Other student level projects in brief are mentioned below
Developed an Online Chat Application using Java Swing as Front-end and EJB as middleware technology. I mainly worked on session beans and entity beans.
Team Size: 5
*Created a website for an intranet canteen using HTML, JAVASCRIPT and JSP at NCST as part of Web programming module (WEBP). Designing database schema, making database connectivity using JDBC, session management.
Team Size: 4(Was team leader)
*“Restaurant Billing System” using Visual Basic 6.0 as Front end and MS-SQL Server as Back end (DBMS) Module at NCST. I was mainly involved in designing of the schema, creating tables and implementing stored procedures.
Team Size: 3(Was team leader)
*“Materials Management System” in C++ as a part of Programming in C & C++ (PCCP) Module at NCST. I worked on the design of the system, programmed production section, inventory section and other related work.
Team Size: 4 (Was team leader)
*Implemented “Data Link Layer” using JAVA as part of Computer Networks (CNET) module at NCST. I implemented Framing, Deframing, Sliding Window Protocol and other project related work.
Team Size: 3(Was team leader)
Inventory System” Using JAVA Swing as Front-End and MS-SQL server as Back-End at NIIT. Worked mainly on front-end. Implementing action listeners, grid bag layout etc.
Team Size: independently
|
|
|
|
|
What you need to do is to look at the syllabus of ur MCA program, and decide, if that is what you want!
"Rejoice always, pray without ceasing, in everything give thanks; for this is the will of God in Christ Jesus for you."1Thess. 5:16-18
|
|
|
|
|
Please help me on this: How to prevent re-submision when the page is refreshed without using redirection.
I have 01 html page and 01 asp page. User input their information on html page and then submit to asp page for processing (save into database). The asp page will then display a "thank you" message. Sometimes user press "F5" key in this page and once again, asp page re-processes.
I can redirect user to another page after processing, but cannot with earlier browser version.
Thank you.
|
|
|
|
|
>I can redirect user to another page after processing, but cannot with earlier browser version.
What older browser is this and how are you attempting to redirect? With client-side script or server-side?
regards,
Paul Watson
South Africa
Michael Dunn wrote:
"except the sod who voted this a 1, NO SOUP FOR YOU"
Crikey! ain't life grand?
|
|
|
|
|
how do i make a messagebox pop up in a asp.net webform
chad
|
|
|
|
|
Hi Chad. You can use the javascript alert() function to make a messagebox appear client-side.
|
|
|
|
|
I'm having trouble opening a file and reading it's contents when its within the application directory. I get access denied reading a text file. However, I can read an XML file in the same directory using the XMLDOM. I'm using the FSO (File System Object) inside global.asa to load some setting from a text file.
|
|
|
|
|
Hi!, i need to make a pop up window without toolbox buttons, i don't want to see minimize, maximize and close...
Here is my example i write "toolbar=no" but nothing happend... can any help ME!!!?!!!
<HTML>
<script language="JScript">
function foo()
{
window.open("about:blank",null,
"height=200,width=400,title='',status=no,toolbar=no,menubar=no,location=no ,titlebar=no,toolbox=no");
}
</script>
<body onclick="foo();">
Click this page and window.open() is called.
</body>
</HTML>
|
|
|
|
|
Adding resizable=no will eliminate the min/max button, but I don't think the security model in JavaScript permits you to eliminate the close button unless you use signed scripts.
TOC
|
|
|
|
|
resizable: specifies whether to display resize handles at the corners of the window, not eliminate the min/max buttons!...
What are signed scripts?!
Thanks for yoour time!!!
function foo() {
window.open("about:blank",null,"resizable=0");
}
Click this page and window.open() is called.
|
|
|
|
|
Sorry about that, I must have confused it with dialog windows. I don't think that you can do what you want with just JavaScript windows. Here are some good links though.
Here are two good sites:
http://www.mozilla.org/projects/security/components/signed-scripts.html -- script signing
http://tech.irt.org/articles/js128/ -- primer on pop up windows
http://www.webreference.com/js/column7/attributes.html -- another primer with examples & code generator
TOC
|
|
|
|
|
Thanks a lot! i will check the sites !!!
I told you if i found how to make it !!!
|
|
|
|
|