
steveh62
Members-
Posts
45 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
steveh62's Achievements

Member (2/5)
0
Reputation
-
thanks for that...but I have now opted to send the data items to mysql to handle all of the cart_items including a unique user session id. Basically, I send all of the data to a table and when inserted it sends the user to viewcart which checks the current session_id against one created when adding item/s to the cart and shows the user/buyer what they have ordered. additonally there is date added to an item added to the cart, this will be used to 'flush' the table after an hour or so...so as to not bog the table with unused data. I just thought I could have used a better way for a user to track their goods when adding them to cart...OH well
-
thought as much...a session array that is then travel that array to pull the relavent data out on a <tr><td>row</td></tr> at the moment I am passing all the data to another php processor page which collects and can echo that data....I just needed it in a way that looks and acts like a cart.
-
try just using the php variable alone for the countryID <?php $colname_RsCities = "-1"; if (isset($_GET['CountryID'])) { $colname_RsCities = $_GET['CountryID']; } mysql_select_db($database_international, $international); $query_RsCities = sprintf("SELECT * FROM city_list WHERE CountryID = $colname_RsCities ORDER BY CityName ASC"); $RsCities = mysql_query($query_RsCities, $international) or die(mysql_error()); $row_RsCities = mysql_fetch_assoc($RsCities); $totalRows_RsCities = mysql_num_rows($RsCities); ?>
-
this might help I was trying to make labels and checkboxes in a similar way <?php $labels = array( 0 => '200mm x 200mm', 1 => '200mm x 300mm', 2 => '200mm x 400mm', 3 => '200mm x 500mm', 4 => '200mm x 600mm', ); foreach ($labels as $named1 => $label) { print '<label>' .$label. '</label><input id="sizes" name="sizes[' .$named1. ']" type="checkbox" value="' . $label. '" onclick="setChecks(this)"'; //if ($key == 0){ // print "checked"; //} print ' /><input id="price" name="price[' .$named1. ']" type="text" class="dropdown" /><br/>'; } ?>
-
tr this <p class="red"> <h2><?php echo strtoupper(date("F", $now));?></h2></p> or <span class="red"><?php echo strtoupper(date("F", $now));?></span> and use css to create the class and set the colour and size from there...remember to link the css to the page all the best
-
I have a number of input types like the following retreiving data values from php <form name"" action=""> <input type="hidden" name="pid" value="<? $pid; ?> /> <input type="submit" value="add to cart"/> </form> question is: How can I add to cart the contents of a selected item and then add another [different] item to cart and list them so they are unique to the cart each time an item is added.
-
ok sorted it I was testing for magic_quotes_gpc which errored using stripslashes. so I have edited that out and now it inserts fine...missus
-
so does anybody know why the submittion is inserting an empty entry before inserting the data [sizes] and an associative [price] the array gets looped thru the size array we price[$key] - as $key is the pointer for the size array - so in essence it shuold get the data from 0 to 4 if they are checked and as we loop it inserts the data into the table 'spcanvas_sizes.
-
ok, it looks ok, but its creating an extra entry at the start of the insert into spcanvas_sizes on the test site. Is there a better way to get both the sizes and prices to match up and be inserted into the table?? rgds steve
-
Basically, what happens is the array makes up 5 checkboxes with associated price inputs and on submitting gets posted. As part of the submittion, data and images get inserted to a db table and is assigned an id. **as part of knowing where to associated the sizes the code picks out the latest id and uses that to insert the sizes and prices to a particular id. But on the live test site the db is inserting a BLANK row which in turn gets pushed to the user as option 1 being blank. This does not happen locally tho' <?php $labels = array( 0 => '200mm x 200mm', 1 => '200mm x 300mm', 2 => '200mm x 400mm', 3 => '200mm x 500mm', 4 => '200mm x 600mm', ); foreach ($labels as $ar => $label) { print '<label>' .$label. '</label><input id="sizes" name="sizes[' .$ar. ']" type="checkbox" onclick="setChecks(this)" value="' . $label. '"'; if ($ar == 0){ // print "checked"; } print ' /><input id="price" name="price[' .$ar. ']" type="text" class="dropdown" /><br/>'; } ?> the above gets posted to below <?php if(get_magic_quotes_gpc()) { $gallerytype = stripslashes($_POST['gallerytype']); $wrap = stripslashes($_POST['wrap']); $frame = stripslashes($_POST['frame']); $title = stripslashes($_POST['title']); $description = stripslashes($_POST['description']); $keywords = stripslashes($_POST['keywords']); $category = stripslashes($_POST['category']); $cat = stripslashes($_POST['cat']); $foo2 = stripslashes($_POST['sizes2']); $price = stripslashes($_POST['price']); $sprice = stripslashes($_POST['price2']); $foo = stripslashes($_POST['sizes']); } else { $gallerytype = $_POST['gallerytype']; $wrap = $_POST['wrap']; $frame = $_POST['frame']; $title = $_POST['title']; $description = $_POST['description']; $keywords = $_POST['keywords']; $category = $_POST['category']; $cat = $_POST['cat']; $foo2=$_POST['sizes2']; $price = $_POST['price']; $sprice = $_POST['price2']; $foo = $_POST['sizes']; } /////////load it//////////// mysql_query( "INSERT INTO gallery(`galleryType`, `print`, `frame`, `title`, `filename`, `desc`, `keywords`, `gid`, `gCATID`) VALUES('".$gallerytype."', '".$wrap."', '".$frame."', '".$title."', '".addslashes($thumbname)."', '".$description."', '".$keywords."', '".$category."', '".$cat."')" ); //now retrieve last item from gallery as it will need to have at least 1 size applied to spsizes table $qry = mysql_query("SELECT * FROM gallery ORDER BY id DESC LIMIT 1"); while( $row = mysql_fetch_array( $qry ) ) { $id = stripslashes($row['id']); echo 'latest id:'.$id; } imagejpeg($tn, $save, 80) ; echo "<span class='dropdown'>Large image:</span> <img src='".$images_dir."/".$imagepath."'><br>"; echo "<span class='dropdown'>Thumbnail:</span><img src='".$images_dir."/tb_".$imagepath."'>"; ////get sizes//////////////////////////// ////select for specials one only size and price if(isset($foo2)){ mysql_query( "INSERT INTO spcanvas_sizes(`sizes`, `canv_price`, `pid`) VALUES('".$foo2."', '".$sprice."', '".$id."')" ); } ///checkbox//// if(isset($_POST['sizes'])){ $foo = $_POST['sizes']; //if(isset($_POST['$foo'])){ if (count($foo > 0)) { // loop through the array foreach ($foo as $key => $size) { echo $key.'<br/>'; $sprice = $_POST['price'][$key]; //echo 'price:'.$sprice; //for ($i=0;$i<count($foo);$i++) // {//now insert sizes in table spcanvas_sizes mysql_query( "INSERT INTO spcanvas_sizes(`sizes`, `canv_price`, `pid`) VALUES('".$size."', '".$sprice."', '".$id."')" )or die(mysql_error()); // do something - this can be a SQL query, // echoing data to the browser, or whatever //echo "<li>$foo[$i] \n"; } //end for loop } //end if count }//isset sizes ?>
-
any ideas anyone?? please its nearly finished but for this...can't see why everything is ok locally but not on live test site
-
Not telling me a thing. I have errors turned on so I will see them/any if they occur. Additonally, I am NOT getting the above error Locally...everything inserts to the db as it should without including a blank entry at the start of insertion
-
I have a number of variables which I post and collect via $var = $_POST['something']; in particular the following gets sent by post <?php $labels = array( 0 => '200mm x 200mm', 1 => '200mm x 300mm', 2 => '200mm x 400mm', 3 => '200mm x 500mm', 4 => '200mm x 600mm', ); foreach ($labels as $ar => $label) { print '<label>' .$label. '</label><input id="sizes" name="sizes[' .$ar. ']" type="checkbox" onclick="setChecks(this)" value="' . $label. '"'; if ($ar == 0){ // print "checked"; } print ' /><input id="price" name="price[' .$ar. ']" type="text" class="dropdown" /><br/>'; } ?> and then picked up and used like <?php $foo = $_POST['sizes']; //if(isset($_POST['$foo'])){ if (count($foo > 0)) { // loop through the array foreach ($foo as $key => $size) { //echo $size.'<br/>'; $sprice = $_POST['price'][$key]; //echo 'price:'.$sprice; //for ($i=0;$i<count($foo);$i++) // {//now insert sizes in table spcanvas_sizes mysql_query( "INSERT INTO spcanvas_sizes(`sizes`, `canv_price`, `pid`) VALUES('".$size."', '".$sprice."', '".$id."')" ); // do something - this can be a SQL query, // echoing data to the browser, or whatever //echo "<li>$foo[$i] \n"; } //end for loop } //end if ?> THE PROBLEM IS...the data does get POSTED yet the database insert an extra record at the begining with nothing inserted ANY IDEAS ANYONE