Page 1 of 1
Help please !
Posted: Thu Dec 18, 2003 7:46 am
by faz222
Well, since I'm totally new to Php and know just a tiny little bit of javascript so this is going to be funny ... at least for you guys
Here is an example of what I would like my site to do :
Some pictures are displayed on the main pages (like a catalogue) and I would like the viewer to be able to select the one he likes and based on his choice a popup will be created showing what he has choosen presented in a form and ready to be submitted ... still following up to here ?

So the popup window is used as some kind of shopping cart ... simple one at least.
the tricky part is that the viewer should be able to browse the main page and change page but the popup needs to keep his choice and be able to receive more items ...
is that possible ?
and is that possible without any database ?
Thanks !
Posted: Thu Dec 18, 2003 3:01 pm
by qads
hi,
yes it can be done without any database but it will be a pain to add more items

.
the best thing to do is use a database, put items in there and show them on a page, when a user clicks on a item, the pop up shows information for that item (is that want it do?), just use same "window name" for the pop up and it should show new item information (when clicked) in the same window. i am not sure if i understand exectly what you mean.
Posted: Thu Dec 18, 2003 3:20 pm
by JAM
Just agreeing with qads. However, you might be able to bypass a database using $_SESSIONS/$_COOKIES but fact stands, a database is really handy for shopping carts (or it's likes).
Just have in mind; If you think about creating a shopping cart, and especially if it has do do with someone getting money from shopping at it, a database is vital. You would most likely want to store transaction of older purchases for later referal...
Posted: Thu Dec 18, 2003 8:39 pm
by faz222
Qads > Yes I think you understand what I was trying to say ... simply add items to a popup when they are clicked in the main window.
I understand that a database would be better but my web host have none and I can just use Php at best
Jam > hum, so it can be done with cookies, right ?
In fact there will be no other info than just the name of the item clicked. This means no money, no transaction ... it will simply be a request sent by email for the viewer to know more about those items !

So the only that I need to pass to the popup would be the name of the item/picture and be able to display in the popup the same item/picture clicked in the main window (.. but this would be luxury hehe)
I'll try to find some tutorial or scripts about that ... but if you guys could give me some clues or links that would be great. Or perhaps even a script that could do just this or close enough to this so that I can use it ... not that I'm being lazy but simply that I'm not a programmer
Thanks again !!

Posted: Fri Dec 19, 2003 3:43 am
by qads
cookie?

for what? if you just want to show selected item in the pop up then all you have to do is pass the id/name to it, you can use text files to store the items, or better yet, creat a file with all the items with a array and include at top of every page you need it on. i.e.
Code: Select all
<?php
//items.php
$items[] = "item 1";
$items[] = "item 2";
$items[] = "item 3";
$items[] = "item 4";
$items[] = "item 5";
$items[] = "item 6";
?>
lets say you want to display items in show.php
Code: Select all
<?php
//show.php
require_once("items.php");
//ju8st a example...
echo "<a href="pop up code goes here...\?item=".$item['4']."">".$item['4']."</a>";
?>
on click, javascript will pass array key in the get, and all you have to do is output the item with
Code: Select all
<?php
//item_information.php
require_once("items.php");
$it = $_GET['item'];
echo $item['$it'];
?>
haveing 1 single page for item array will help you update the items quickly, i am sure you will need more information in array, so checkout [php_man]array[/php_man] at php.net for information

.