Jump to content

rich_web_development

Members
  • Content Count

    35
  • Joined

  • Last visited

Community Reputation

0 Neutral

About rich_web_development

  • Rank
    Newbie

Profile Information

  • Location
    England
  1. <script> var buttons = document.getElementsByClassName("add-panel"); for(var i = 0; i < buttons.length; i++) { buttons[i].addEventListener("click", addPanel, false); } var panels = []; function addPanel(e) { // Get a reference to the button that was clicked var button = e.currentTarget; var value = button.getAttribute("data-value"); if(panels.indexOf(value) == -1) { // Add the button's value to the array panels.push(value); // Display the contents of the array on the page by generating <li> elements. var demo = document.getElementById("demo"); d
  2. is this any good? <script> var buttons = document.getElementsByClassName("add-panel"); for(var i = 0; i < buttons.length; i++) { buttons[i].addEventListener("click", addPanel, false); } var panels = []; function addPanel(e) { // Get a reference to the button that was clicked var button = e.currentTarget; //----------------------------------------------- //Code to stop items being applied twice to array //----------------------------------------------- for(var i = 0; i < panels.length; i++){ if(panels[i] != button.getAttribute("data-value")){ console.log(p
  3. Ok. I'll try and understand what you've given me first then I'm sure I'll be able to work the rest out. Thanks for the quick reply
  4. WOW! Thanks. I was trying all sorts of stuff for the past two days and just couldn't get my head around it. Thank you very, very, very much! Just tried it and it works I don't suppose, if it's not to much of a cheek, you can tell me how I can adjust it so that it can only add the specific product once? If I click on a button for a product twice it adds the product twice. I plan to have a quantity input underneath that I will try and implement. Again, thanks
  5. I thought you'd just be able to do something like: <!DOCTYPE html> <html> <body> <button onclick="myFunction1"> Click to add 4 Panel Smooth</button> <button onclick="myFunction2"> Click to add 4 Panel Grained</button> <p id="demo"></p> </body> </html> <script> var products = []; var products, text, fLen, i; fLen = products.length; text = "<ul>"; for (i = 0; i < fLen; i++) { text += "<li>" + products[i] + "</li>"; } text += "</ul>"; document.getElementById
  6. Hi, Sorry, in advance, if this is a simple question. I want to be able to use CSS combinators to select two child elements of a parent element. I know it can be done various other ways. Could someone please let me know if I can use combinators to achieve this effect. So for example: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style&g
  7. I didn't mean that you showed me only static. I rushed my last post and I'm still learning about all this web dev stuff. Apologies for my post being unclear. Thanks for all your help and advice.
  8. Thanks for that. I just commented out the w3custom-list > p b + span {display: inline-block; width: 68%;} bit and now the static text and the info line up side by side. I have another problem now. Now that I have the photos and info coming from a database so I have no need for the static information for example: <div class="w3-third w3-container w3-margin-bottom"> <img src="parkhome8.jpg" alt="Norway" style="width:100%" class="w3-hover-opacity"> <div class="w3-container w3-white w3custom-list"> <p><b>Name</b> <span>Holiday home</span>&l
  9. That is amazing. Thank you very much. When the browser is small the static text and info line up side by side which is exactly what I wanted to achieve. When the browser is full screen the info appears underneath the static text. Is there a way for the info to be displayed side by side with the static text when the browser is in full screen? Is there something wrong with the w3schools website? When I visit a page it jumps to the bottom of the page and starts playing some video with music. Just went to a page and it started playing some ad for Thomson Cruises.
  10. Hi, I'm trying to edit the W3.CSS portfolio template. The part I want to edit looks as follows: <!-- First Photo Grid--> <div class="w3-row-padding"> <div class="w3-third w3-container w3-margin-bottom"> <img src="parkhome8.jpg" alt="Norway" style="width:100%" class="w3-hover-opacity"> <div class="w3-container w3-white"> <p><b>Lorem Ipsum</b></p> <p>Praesent tincidunt sed tellus ut rutrum. Sed vitae justo condimentum, porta lectus vitae, ultricies congue gravida diam non fringilla.</p>
  11. Thank you very much. I think I have it now. Well, it works anyway. Although where should I place the '$result->close(); $conn->close();' within the below code? I have changed the code as follows: <?php require_once 'login.php'; $conn = new mysqli($hn, $un, $pw, $db); if ($conn->connect_error) die($conn->connect_error); if (isset($_POST['delete'])&& isset($_POST['serialno'])) { $serialno = mysql_entities_fix_string($conn, 'serialno'); $query = "DELETE FROM holidayhomes WHERE serialno='$serialno'"; $result = $conn->query($query); if (!$result) echo "DELETE faile
  12. I still get the same error if I remove the parens $stmt = $conn->prepare("SELECT name, bedrooms, length, width, mainpic, serialno FROM holidayhomes VALUES (?,?,?,?,?,?)"); $stmt->bind_param("ssssss", $name, $bedrooms, $length, $width, $mainpic, $serialno); $stmt->execute(); $result = $stmt->get_result();
  13. I have tried lots of different combinations to try and use prepared statements with the 'SELECT * FROM' part on line 95. I just cannot work out how to use prepared statements on this 'SELECT * FROM' part. I have tried replacing from line 95 to 97 with the following: $stmt = $conn->prepare("SELECT (name, bedrooms, length, width, mainpic, serialno) FROM holidayhomes VALUES (?,?,?,?,?,?)"); $stmt->bind_param("ssssss", $name, $bedrooms, $length, $width, $mainpic, $serialno); $stmt->execute(); $result = $stmt->get_result(); When I replace line 95 to 97 with the above code I g
×
×
  • Create New...