Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Sepodati

  1. The question is more about you than the breeds. What kind of living situation do you have? Apartment or room to run? Kids? Will the dog be left alone while you're at work? What kind of climate do you live in? etc... Not saying you need to answer all of that, here, but consider what you bring to the table for the dog, rather than just the breed / style you want.
  2. Why program a back button when the browser already has one, though?
  3. You have to remember or pass $industry and $position back to Search-Result.php. Keeping them in a session may work. If they are passed as a part of a form, prefer those values, but otherwise look in a session for "previous" values of the two search terms.
  4. Never trust the data you are given, the user is irrelevant.
  5. You need to learn that when dealing with forms, there are two actions that take place. The first action is to display your form and the second action is to process the form once it's submitted. You're blending these actions in the same file (which is okay), but the form creation and form processing are being handled all within each other and it's confusing. $sname_array is only set when you're processing the form, not before. Because it's only defined in a block of code that's run when a $_POST variable is present. Structure your code so that it's clear when the form is being processed versus when it's being displayed. if(isset($_POST['submit'])) { //process form } else { //display form } Also, I don't think these lines are doing what you think they're doing... while ($sline = fgets ($sfile)) { $name = explode (',', $sline); }
  6. Your logic is flawed. The loop will only continue if the conditions evaluate to true. $headcount is not equal to 2 and $loopcount is not equal to 5, so the condition fails and the loop exists after the first go. What I think you want is the loop to continue while $headcount is less than 2 or $loopcount is less than 5.
  7. <strong>Repair Status:</strong> <select name="status"> <option value="In Queue">In Queue</option> <option value="Working on">Working on</option> <option value="Awaiting Parts">Awaiting Parts</option> <option value="Ready for Collection/Delivery">Ready for Collection/Delivery</option> <option value="Complete">Complete</option> <option value="Unable To Repair">Unable To Repair</option> </select> Where exactly are you applying any PHP logic to set the option value?
  8. Well, yes and no. Google will have no idea that domain.com/index.php?id=45678 exists with unique content separate from just index.php. Unless it encounters a link to that page, then it'll follow it and index it. Unless I'm totally mistaken by how things are done nowadays, Google isn't going to guess at query string values to find pages, but it will follow links it encounters.
  9. http://php.net/manual/en/function.file.php
  10. This sounds like a classic "help me solve my solution" rather than "help me solve my problem"...
  11. SELECT * FROM categories WHERE parent='parent_id' You don't see an issue with that?
  12. Write a PHP script that scrapes the web, looking for complex problems to solve.
  13. I still think this is a naming issue with being able to relate a checkbox to a text box. Consider this. I created a form that asks for a Name, Age and has a checkbox on whether that person should be validated. I supplied four names, four ages and clicked validate on two of the names. With the below dump of the $_POST data, can you tell me what two names I checked? array(3) { ["name"]=> array(4) { [0]=> string(4) "John" [1]=> string(5) "Roger" [2]=> string(7) "Rebecca" [3]=> string(5) "Bobby" } ["age"]=> array(4) { [0]=> string(2) "29" [1]=> string(2) "33" [2]=> string(2) "65" [3]=> string(2) "12" } ["validate"]=> array(2) { [0]=> string(3) "Yes" [1]=> string(3) "Yes" } }Hint, it wasn't John and Roger. Now... consider this method. Instead of just naming the form elements name[], age[] and validate[], I instead use the following code: for($i = 0; $i < 4; $i++) { ?> <p>Person #<?=$i?></p> <p>Enter Name: <input type="text" name="name[<?=$i?>]" value="" /></p> <p>Enter Age: <input type="text" name="age[<?=$i?>]" value="" /></p> <p>Validate: <input type="checkbox" name="validate[<?=$i?>]" value="Yes" /></p> <hr> <?php }Now that produces a form like this: <p>Person #0</p> <p>Enter Name: <input type="text" name="name[0]" value="" /></p> <p>Enter Age: <input type="text" name="age[0]" value="" /></p> <p>Validate: <input type="checkbox" name="validate[0]" value="Yes" /></p>Where $i keeps getting put in the [] for each element. So I have name[0], name[1], name[2] and name[3], along with the same for age[] and validate[]. Now when I submit the form with the same data and same boxes checked as before, can you tell which two names I checked to validate? array(3) { ["name"]=> array(4) { [0]=> string(4) "John" [1]=> string(5) "Roger" [2]=> string(7) "Rebecca" [3]=> string(5) "Bobby" } ["age"]=> array(4) { [0]=> string(2) "29" [1]=> string(2) "33" [2]=> string(2) "65" [3]=> string(2) "12" } ["validate"]=> array(2) { [0]=> string(3) "Yes" [2]=> string(3) "Yes" } }
  14. $together['p_order'] doesn't make any sense, notwithstanding that there's no p_order element in your form, as mentioned. Can you post a var_dump() of $_REQUEST once you've submitted this form, with some boxes checked and others not checked? An actual copy/paste of the generated HTML form would be helpful, too.
  15. You have to do it in two steps, then, or involve JavaScript.
  16. Why are you letting the user change the charge value at this point? Why isn't that a hidden field, too, and just the value displayed?
  17. I assume you've worked through the first three issues and ruled them out? Is there documentation on how they expect you to generate the hash?
  18. You have a typo here: $sharedekyt = "*************"; That would create an issue as the shared key is not being included in the hash.
  19. You're including date and time, down to the second, in the string to hash. So the hashes will only be calculated the same on the same second. Assuming wherever you post this form to does the same hash, it'd also have to do so within the same exact second to get a matching value.
  20. Did you click the link and still not get an answer? It lists out VERY CLEARLY what the format should be for date()...
  21. The only "value" from the button is the text that's displayed on it. Why would you need that? If $_POST['search'] is set (check using isset(), as shown), then the form has been submitted, i.e. the button has been clicked. The click process causes the page to reload and set the $_POST['search'] and $_POST["product_category"] values. The $_POST["product_category"] value is the option that was chosen in the select, before the button was clicked. So taking your code where you create the <select> and button, you'd need to add some PHP code to process those values once the button is clicked (submitting the form). <?php include 'dbconn.php'; ?> <!DOCTYPE html> <html> <head> <title>Register</title> <link rel="stylesheet" type="text/css" href="style.css"> <script type="text/javascript" src="java.js"></script> </head> <body> <div class="headerBar"> TOP </div> <div class="sideBar"> <?php require 'productCatagory.php' ?> </div> <div class="mainArea"> <form action="" method="post"> <p>Select category: <select name="category"> <?php $sql = "SELECT DISTINCT(product_catagory) FROM `products`"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { $pro_cat = $row["product_catagory"]; echo <<< "EOT" <option value="$pro_cat">$pro_cat</option> EOT ; } } else { echo <<< "EOT" <option value="None_Found">No Products Found</option> EOT ; } // $conn->close(); ?> </select> <button type="submit" name="search">Search</button></p> </form> <?php //Assuming it's okay to show the results of clicking the button here? if(isset($_POST['search'])) { $stmt = $this->conn->prepare("SELECT * FROM products WHERE product_category=?"); $stmt->bind_param("s", $_POST["product_category"]); $stmt->execute(); $result = $stmt->get_result(); if($result->num_rows => 1) { echo 'Results: '; while ($data = $result->fetch_assoc()) { // your echo goes here, showing whatever you want from the database query } else { echo 'No results found'; } } ?> <div class="buttonArea"> <?php require 'productButtons.php' ?> </div> <div class="itemArea"> <div class="itemisedArea"> <textarea class="FormElement" name="term" id="term" style="width: 98%; height: 100%;"></textarea> </div> <div class="keypadArea"> </div> </div> </div> </body> </html> Watch your spelling on category (vs catagory), by the way. I think the flow Req. is taking you through, btw, is to get the basic functionality working with vanilla HTML and PHP. Then you can start moving parts of this to specific PHP scripts that can receive and send data via AJAX calls. Then you'll have to move into JavaScript to receive the data and modify the page to show the results.
  22. Where's the data in the array coming from?
  23. I don't think that's what you want. Walk me through the sequence here. When I check "USA Guitars" which as a category of "3", you also want to know that the orderp value relating to USA Guitars/category 3 is "2", right? And when you build your query, you want to know that category 3 has an orderp value of 2, right? If you used your above code, and checked the second checkbox for "Guitars" category "1", you'd have the following two arrays in $_POST or $_REQUEST: ['prodCategories'] = array(3=>'3') ['orderp'] = array(2=>'2', 5=>'5')
  • 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.