Jump to content

cyberRobot

Moderators
  • Posts

    3,145
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by cyberRobot

  1. Variables don't work within single-quoted strings. In this case the quotes could be removed: $item_return[$item]
  2. As trq suggested, you could use JavaScript/jQuery to direct visitors to the proper page. Just keep in mind that JavaScript can be disabled. Since this seems like a critical interaction, it's a good idea to have a backup. To redirect visitors using PHP, you would need to name the <select> element. That lets you access the selection in PHP. You can then redirect the visitor to the proper page using the header() function. http://php.net/manual/en/function.header.php With that said, can the pages for LCCC and CSU be merged? If they are similar enough, perhaps you could use the form selection to populate one page based on a database?
  3. For the fly-out menu links (the bulletin, etc.), have you tried adding the "display:block;" declaration. You'll also need to define the width so the anchor tag doesn't exceed the underlying box. This should expand the clickable area so visitors don't need to click the text.
  4. More information can be found here: http://php.net/manual/en/function.header.php
  5. You could try using str_repeat(): http://php.net/manual/en/function.str-repeat.php
  6. Have you tried echoing $status on the PHP side to see what it contains? Side note: perhaps you were going to do this later, but it's recommended that you sanitize/validate any user-supplied information before using it in things like MySQL queries. Since $_POST["refNum"] is supposed to be a number, you could utilize ctype_digit(): http://php.net/manual/en/function.ctype-digit.php
  7. Sorry, I'm not sure I follow. Where does "cjbzeo" come from? Is it pulled from the string that you got from $_SERVER['REQUEST_URI']? Or do you have PHP pulling the actual content from a website and it's somewhere in that source code?
  8. Have you tried looking here: https://www.google.com/search?q=using+TCPDF+with+php
  9. Instead of using an <img> tag, have you tried using the background-image property: https://developer.mozilla.org/en-US/docs/Web/CSS/background-image Note that you could also utilize the background property: https://developer.mozilla.org/en-US/docs/Web/CSS/background
  10. Also, are you trying to echo the database value...or the GET variable? If you're trying to display the database value, you need to use the $row variable.
  11. First, what is the name of the GET variable in the real URL? Your code suggests that it's "map_link". However, your original post (below) suggests that it's "map".
  12. It looks like you're using $map before it's initialized. Try moving the following line above the query. $map = $_GET['map_link'];
  13. @prathameshkakade - What was the code you tried? If you got any errors, what were they?
  14. The following should help guide you for getting the "map" variable from the URL: http://php.net/manual/en/reserved.variables.get.php Once you feel comfortable with GET variables, you could then use the information to perform the MySQL query. Here's some information on executing a query with MySQLi: http://www.php.net/manual/en/mysqli.query.php Or you could use PDO: http://php.net/manual/en/pdo.query.php
  15. Instead of running two queries, you could use mysql_insert_id(): http://php.net/manual/en/function.mysql-insert-id.php Also note that the following line of code appears twice. The second reference isn't necessary. $id = $_GET['id'];
  16. PHP could be utilized to determine which page is being viewed. If the page matches one of the links in the menu bar, a class attribute could be added dynamically (with PHP) so the link is highlighted. Perhaps something here will help: https://www.google.com/search?q=dynamically+highlight+links+in+website+navigation+with+php
  17. You sure can; where are you stuck? If you're unsure how to get the date information once the link is clicked, perhaps the following will help: http://php.net/manual/en/reserved.variables.get.php
  18. Holy cow...that's a nice surprise. Thanks
  19. Have you looked into explode()? http://php.net/manual/en/function.explode.php
  20. I'm not very familiar with the service, but they provide a couple different options for sharing files. The Collaboration option makes it so you'll both be able modify the file. If you use the Share option instead, they should only be able to download a copy. If they make any changes, it shouldn't affect the original. To make sure that's true, you could create a second test account with MediaFire to see how it works.
  21. How are you sending the file? If it's sent through e-mail, for example, you're just sending a copy. It doesn't really matter what they do with the file. Just don't accept a file back from the friend and replace your copy.
  22. Have you looked into microtime()? http://php.net/manual/en/function.microtime.php
  23. Is there a reason why you don't want to store the date as YYYY-MM-DD? That format is more useful for things like sorting. When displaying the data, you could always use MySQL's date_format() function: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format
  24. The process could be simplified by storing the column information in an array and using array_chunk() to break it into groups of 5. Oddly enough, I just posted a blog entry about this technique: http://www.cyberscorpion.com/2013-08/build-html-tables-dynamically-with-php-part-2-simplify-with-array_chunk/ Basically, you could do something like the following (note that the following code is untested): <?php //INITIALIZE OUTPUT ARRAY $dynamicList = array(); //GRAB COLUMN INFORMATION while($row = mysql_fetch_array($sql4)){ $id = $row["id"]; $product_name = $row["product_name"]; $price = $row["price"]; $category = $row["category"]; $details = $row['details']; $date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); $dynamicList[] = '<td width="150"><a href="inventory_images/'.$id.'.jpg" target="_blank"><img style="border:#666 1px solid;" src="inventory_images/' . $id . '_small.jpg" alt="' . $product_name . '" border="1" width="150"/></a> '.$details.'£'.$price.' <form id="form1" name="form1" method="post" action="cart.php"><input type="hidden" name="pid" id="pid" value='.$id.' /><input type="submit" value="" name="button" id="button" class="cardbutton" /></form></td>'; } //BREAK APART ARRAY $dynamicList = array_chunk($dynamicList, 5); //DISPLAY TABLE print '<table>'; foreach($dynamicList as $currRow) { print '<tr>' . implode('', $currRow) . '</tr>'; } print '</table>'; ?>
  25. Have you tried storing the information as a multi-dimensional array and then using array_multisort()? Example 3 from the following link seems like it would work: http://php.net/manual/en/function.array-multisort.php
×
×
  • 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.