Jump to content

mik_se7

Members
  • Posts

    19
  • Joined

  • Last visited

Everything posted by mik_se7

  1. I'm sorry i do not know much about this subject only that image mapping was a way to manipulate images, have you tried to look at the source code of the website with the sofas? most browsers you right click on the background and chose view source.
  2. also while i'm thinking about your issue this would possibly be better handled with Javascript and ajax as PHP isn't actioned unless the page is refreshed in someway or the php code is called.
  3. No that will just set your site to the time of your country and then your timing to midnight in Pakistan should work. you may have to reference it as a variable to get it to work with your crok1 and crok2 variables.
  4. you can set the default timezone for your country like this replacing Country with your country, but check out this link because i couldn't find Pakistan on the list so you will need to find the closest to you that will fit your needs. http://php.net/manual/en/timezones.php <?php date_default_timezone_set("Country"); echo date('d-m-Y H:i:s'); //Returns IST ?>
  5. I believe its done using a process called image mapping here is a link that might get you started http://www.makeuseof.com/tag/create-image-map-gimp/ gimp is a free image software you can download. this website suggests using other programs to slice the image and assign each part different URL's http://www.htmlgoodies.com/beyond/css/how-to-create-image-maps-with-html-and-css.html
  6. whats on line 94 in add-contactme.php
  7. you need to change the code to: for the name: if(isset($_POST['author'])) { $name = $_POST['author'] and for comments to if(isset($_POST['text'])) { $name = $_POST['text'] now the code should work just copy and paste this section over that code: // check to make sure name exists in POST if(isset($_POST['author'])) { $name = $_POST['author']; } else { // add error to $errors array $errors[] = 'Please enter your name'; } // check to make sure email exists in POST if(isset($_POST['email'])) { $email = $_POST['email']; } else { // add error to $errors array $errors[] = 'Please enter your email address'; } // check to make sure phone exists in POST if(isset($_POST['phone'])) { $phone = $_POST['phone']; } else { // add error to $errors array $errors[] = 'Please enter your phone number'; } // check to make sure comment exists in POST if(isset($_POST['text'])) { $comment = $_POST['text']; } else { // add error to $errors array $errors[] = 'Please enter your comment'; } // end validation
  8. your passing your values but not telling where you want to add them. INSERT INTO table name (name,email, phone, comments) VALUES ('$name', '$email', '$phoneno''$comments') also you have 2 $result variables i would change the query to $query rather than $result
  9. looking at the HTML code you have posted your not getting the values because your asking php to collect Name, Email, Phoneno, Comments but your id / names of your inputs are Authour, Email, Phone, Text. the $_POST will be looking for the input id / name to get the post from. if (isset($_POST['author']) && ($_POST['author'] !='')){ // get data from post $name = $_POST["author"]; $email = $_POST["email"]; $phoneno = $_POST["phone"]; $comments = $_POST["text"]; // echo result $result = $name - $email - $phoneno - $comments; } just put the <?php echo $result; ?> between your body tags in the HTML for testing purposes and it should display what is being sent from the form.
  10. can we see your HTML code as it appears that the php cannot find the values name, phone, etc also it might help if at the top of your php you put $name = ""; $email = ""; $phoneno = ""; $comment = ""; this means that the variables are empty because until the forms details are entered they are empty and won't return a value for php to find an index and that should clear those errors
  11. I cannot understand why you would want to convert and show the answer on a different page? you could divide your page into div's and have a results div at the bottom of the page near the submit button. you could then either have the php code above the HTML on the same page or use the include function to include the php stored on another page. that way you would have the user select conversion > submit form > php converts > answer appears in result div.
  12. not sure if you need this or might find it helpful: a check box on my form: <div id="table2a"> artist:<input id="checkboxes[]" name="artist" type="checkbox" value="Yes" onfocus="emptyElement('status')" maxlength="10"> </div> and more php code for you if you want to get the data for your database after the $variable i gave you before: $artist = mysqli_real_escape_string($db_conx, $artist); $db_conx is a connection file to my database which is more secure than posting your connection details in a support post and if anyone checks out your source code.
  13. I used this php code for check boxes i had on a form i created: $variable = (isset($_POST['artist']) && $_POST['artist'] == 'Yes'); or you might find javascript more helpful: function getArtist(){ var artist =[]; var art = document.getElementsByName("artist[]"); for(var m=0; m<art.length; m++) if(art[m].checked){ artist.push(art[m].value); alert("the artist is "+artist); } } the javascript and php may require some work to fit your code and the javascript will require ajax code to send the data back to php for you to add to your database if required. you can remove or // the alert i just put that there to help you see if you get the right value your expecting
  14. what happens with the code as it is does it give you an error message or not display all the fields? does it go onto the next page?
  15. Have you tried putting an alert in the if statement that is equal to 3 to see if the if statement is being actioned?
  16. In my shopping cart i want an alert message when the maximum number of 5 for the item has been reached or ask them to delete the item if the press - when the item quantity is at 1. i have it working in php: //add to quantity of item if (isset($_POST['itemadd'])){ $additem = $_POST['additem']; $sqladd = "SELECT quantity FROM orders WHERE id = '$additem'"; $query_add = mysqli_query($db_conx, $sqladd); while($row = mysqli_fetch_array($query_add, MYSQLI_ASSOC)){ $itemqty = $row['quantity']; if ($itemqty < 5){ $addqty = $itemqty + 1; $adding = "UPDATE orders SET quantity = '$addqty' WHERE id = '$additem'"; $add_query = mysqli_query($db_conx, $adding); header('Location: http://www.quichlicious.co.uk/cart.php'); //print $additem; exit(); } else { $usemes = "You have reached maximum quantity"; } } But rather than display the message in a div i would like a javascript alert box to pop up, i tried the following code: <script type="text/javascript"> function CheckQtyPlus(){ var qty = '<?php echo $qty; ?>'; alert("message here"+qty); } </script> but i get the same quantity number for every item in the cart, i had this error with the php update but i got round that by querying sql to give me the quantity of an item by the items id. can the same thing be done in javascript / ajax? $qty by the way is referenced earlier in the script to get information for the cart table to display items. thanks Michael
  17. Thanks Barand your question lead me on the correct path as you suggested it only had one $qty reference so i added a sql request to get the item quantity by id and gave it another $variable name and hey presto it now works perfectly. Michael
  18. $qty is grabbed from the database using the query below done just before the add and subtract buttons in php tags $sqlfetch = "SELECT * FROM orders WHERE orderid = '$sessionid'"; $order_query = mysqli_query($db_conx, $sqlfetch); $numrows = mysqli_num_rows($order_query); if($numrows < 1){ $result .="Cart is Empty"; header("location: order.php"); exit(); } $result .= "<table><tr><th>id</th><th>Quiche Size</th><th>Pastry</th><th>Cheese</th><th>Toppings</th><th>order placed</th><th>Quantity</th><th>Price £</th><th>Remove</th></tr>"; while($row = mysqli_fetch_array($order_query, MYSQLI_ASSOC)){ $id = $row["id"]; $customerid = $row["orderid"]; $qsize = $row["size"]; $pastry = $row["pastry"]; $cheese = $row["cheese"]; $top1 = $row["top1"]; $top2 = $row["ordered"]; date_default_timezone_set('Europe/London'); $top2date = date("d-m-Y H:i:s", strtotime($top2)); $qty = $row["quantity"];
  19. I have setup a website that has a shopping basket and it displays the objects ordered in a table before being purchased, i have added a plus and minus button to adjust the quantity using the following code: $add ="<form action='cart.php' method='post'><input type='hidden' name='additem' value='$id'/><input type='submit' name='itemadd' onclick='CheckQty()' value='+'/></form>"; $sub ="<form name='sub' action='cart.php' method='post'><input type='hidden' name='subitem' value='$id'/><input type='submit' name='itemsub' value='-'/></form>"; //add to quantity of item if (isset($_POST['itemadd'])){ $additem = $_POST['additem']; if ($qty < 5){ $addqty = $qty + 1; $adding = "UPDATE orders SET quantity = '$addqty' WHERE id = '$additem'"; $add_query = mysqli_query($db_conx, $adding); header('Location: http://www.quichlicious.co.uk/cart.php'); //print $additem; exit(); } else { $usemes = "You have reached maximum quantity"; } } //subtract to quantity of item if (isset($_POST['itemsub']) && ($_POST['itemsub'] !="")){ $subitem = $_POST['subitem']; if ($qty > 1){ $subqty = $qty - 1; $subing = "UPDATE orders SET quantity = '$subqty' WHERE id = '$subitem'"; $sub_query = mysqli_query($db_conx, $subing); header("location: cart.php"); exit(); } else { $usemes = "<font color='red'>Please use delete to remove item</font>"; } } The issue i have is it works great if just one item is in the basket but if i have more than 1 item in the basket i can only adjust the very last item in the baskets quantity and the others just randomly jump numbers or will not change at all? $additem gets the item ID from the table.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.