<?php if (isset($_GET['buy'])) {
echo 'Thank you!';
} ?>
small search function
Whether you're a seasoned veteran or a struggling beginner, Web Radiance is the web development and web design forum for you. You'll find answers to all your HTML, CSS, SEO, and Programming needs. Pull up a chair and stay awhile.
small search function
#21
Posted 21 April 2007 - 01:05 PM
Use this PHP:
#22
Posted 22 April 2007 - 02:32 AM
benbacardi, on Apr 19 2007, 02:18 PM, said:
What's the search box called? I think they'd have to be seperate querys per table but I'm not sure, for example:
ALBUM RESULTS:
(then list results of "SELECT * FROM music_albums WHERE prod_name LIKE '%".$_POST['seach']."%' OR prod_artist LIKE '%".$_POST['search']."%'" )
SINGLE RESULTS:
etc
Where $_POST['search'] is the reference to whatever the user typed in
ALBUM RESULTS:
(then list results of "SELECT * FROM music_albums WHERE prod_name LIKE '%".$_POST['seach']."%' OR prod_artist LIKE '%".$_POST['search']."%'" )
SINGLE RESULTS:
etc
Where $_POST['search'] is the reference to whatever the user typed in
'%".$_POST['seach']."%' ... is a security issue bacuse it allows SQL-injection :-/
Also do some checking on a variable like that instead of just placing it in the SQL.
#23
Posted 22 April 2007 - 02:48 AM
Actually, with the latest versions of PHP, PHP automatically escapes any charactors that can be used for SQL injection, so avoiding that issue
#24
Posted 22 April 2007 - 05:51 AM
#25
Posted 22 April 2007 - 08:03 AM
<?php if (isset($_GET['buy'])) {
echo 'Thank you!';
} ?>
i am guessing i would put this at the top of each page that i use the "Add" button on?
but i think i will have a problem as i have built my shop using case statements to load each page.
and i have set it to always default to index.php, so would the echo still work?
Thanks.
#26
Posted 22 April 2007 - 08:58 AM
Man2u2uk, on Apr 21 2007, 06:55 PM, said:
Woot works like a dream 
the following code:
<? echo '<a href ="'.$_SERVER['PHP_SELF'].
'?buy='.$i.'">Add</a>';?> </div>
places the word "Add" next to each procuct, when "Add" is clicked it adds the product to my basket which works fine...
how can i get it so that after clicking on "Add" it will display a message saying "You have just added (item) to you cart"
the following code:
<? echo '<a href ="'.$_SERVER['PHP_SELF'].
'?buy='.$i.'">Add</a>';?> </div>
places the word "Add" next to each procuct, when "Add" is clicked it adds the product to my basket which works fine...
how can i get it so that after clicking on "Add" it will display a message saying "You have just added (item) to you cart"
explain what you mean? the link could simplt link back to a page that says product added, and then refreshes you back to the last page (like how it does on webradiance, when you do a search)
#27
Posted 24 April 2007 - 05:46 AM
Well at the moment, when i click add it takes me back to the shops home page. really i would like it to say
"You have just added (Item Name Goes Here) to your shopping cart" and then either take them back to the home page.
or give them the option to carry on shopping or goto the checkout
"You have just added (Item Name Goes Here) to your shopping cart" and then either take them back to the home page.
or give them the option to carry on shopping or goto the checkout
#28
Posted 24 April 2007 - 06:50 AM
In my shopping cart site, the Add to Basket button links to a page (addbasket.php) which takes a GET arguement of the ID to be added, adds that ID, then redirects to the basket page...
For example:
viewproduct.php?id=12 ---> addbasket.php?id=12 -- > viewbasket.php
For example:
viewproduct.php?id=12 ---> addbasket.php?id=12 -- > viewbasket.php


Help
This topic is locked

MultiQuote










