Jump to content

Simple Shopping Cart


BaggyHTID

Recommended Posts

Hi,Im pretty new to java (haven't a clue really lol)I've got to create a simple shopping cart, information is input through a form, passed to an array and then can be displayed and edited on another page, i really don't know where to start here. If anyone has any code like this or can help me in anyway i'd greatly appreciate it,thanksSam

Link to comment
Share on other sites

You're going to need server-side code to accomplish this. I'm going to assume that you are using Java (i.e. jsp, jhtml, etc.), although you can use any server-side code: PHP, CF, ASP.NET, ASP, etc.One place to start is to build the form and submit it, and its data, to another page. Then, on the server, get the data from the HTTP Request. In .NET, it'd look something like:

string first_name = Request["FirstName"].ToString();

In PHP, something like:

$fname = $_GET["FirstName"];

Each language will be a little different.Once you are able to get the data, you'll need to look into storing that data across many different pages so that a visitor who is on one page and puts an item in the cart still has those items in his/her cart when s/he visits another page. Most developers would use Sessions for this. Look into how to use Sessions in the language that you use.Alternatively, I'm sure you can find a pre-built solution available that you can purchase for a nominal fee which you can plug into your site so that you don't have to do so much development.I hope this helps!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...