Jump to content

falkencreative

Advanced Member
  • Posts

    4,419
  • Joined

  • Last visited

  • Days Won

    27

Everything posted by falkencreative

  1. You might want to check here for more info on checkboxes: http://www.html-form-guide.com/php-form/php-form-checkbox.html Yes, if the box isn't checked, there's no post data associated with it, so you have to use isset() to check to see if the input is set before you access it and check the value.
  2. You can get shipping quotes from UPS, FexEx, etc -- most will have a program you sign up for that will give you access to that API. Each company will be a little different, so you'll have to figure it out. As far as your site goes, you'll probably need to associate each product with a specific warehouse, then calculate shipping based on the shipping options related to that warehouse.
  3. My impression is that your "SELECT DISTINCT A FROM TempAttributes" query isn't working the way you'd expect -- perhaps it is only returning one result, meaning this section: while ($rec = mysql_fetch_array($result, MYSQL_ASSOC)) { $part = mysql_escape_string($rec['A']); $Model = getModel($part); $query = "REPLACE INTO tbl_Attributes (Part, Model) VALUES ('$part', '$Model')"; $endresult = mysql_query($query) or die ("Query Load failed: " . mysql_error()); } only loops once? The "return" line only returns from the getModel() function -- it doesn't affect the while loop above. All the getModel() function does is insert a string into the $Model variable.
  4. It might be helpful if you post the relevant bits of code that you are having trouble with. I have a general idea of what you need, but it's much easier to help you if I can see actual code in front of me.
  5. I believe that should work fine. Just make sure to do a little testing and ensure the regular expression is working the way you expect it to.
  6. I am not an expert on PHP security. But as far as I know, security issues primarily come into play when: -- something that a user inputs is used within a database query somehow, potentially leading to SQL injection if it isn't properly escaped -- something that a user inputs is displayed to the page without being properly escaped As far as I understand it, isset() simply checks if a variable exists -- it doesn't "use" the variable, so it should be fine.
  7. Unfortunately that isn't the way that includes work. I'm not quite sure what you have in mind... you might look into AJAX instead, where you use Javascript to insert content from a file into a page (for example: http://api.jquery.com/jQuery.get/) or using a session and session variables to keep certain variables defined while switching pages.
  8. The only other thing I can think of is that maybe when you are creating the menu using set_data() in your controller, you're passing in "True" as the third parameter, meaning that htmlspecialchars() is being called, and any code is being escaped rather than being processed properly by the browser. If that isn't it though, I'm not really sure what's going on. If you've checked the controller code and made sure that the above isn't happening, you can try zipping your entire project and emailing it to me (ben [at] killersites.com) and I'll take a look as soon as I have time.
  9. I'm not really seeing any mistakes in the code above, though it's possible I might be missing something. Can you post your template object's get_data() function? That's another thing that might be messing things up.
  10. I use http://www.sxc.hu/ on occasion, but for the most part, I've found that you get what you pay for. For the most part, I rely on relatively low cost paid sites like iStockPhoto or similar.
  11. @grabenair: Not quite true -- a for loop has an automatic break built in. In the code above, it should break after i is no longer less than products.length. (We're also dealing with Javascript here, not PHP.) @Ed4Words: When I run that code (and assuming I click on the header, obviously), the system prints out the four array items, then stops. As far as I can tell, it's working correctly. What is happening that makes you think the code is still running?
  12. This is probably something that is best asked directly to Stefan: stefan [at] killersites.com.
  13. I get the same issue. I don't think this is necessarily PHP related though -- I think it's a Javascript/AJAX issue. I'd probably suggest contacting the makers of the ecommerce plugin -- I can't imagine that you are the only person with this issue.
  14. The problem is on line 15 -- you are subtracting the current timestamp minus the readable date. Instead, you need to be doing: $difference = abs(($timestamp)-($convertedtotimestamp));
  15. Which video are you on in the CMS course? It would be a good idea for me to know how far you've gotten. Each editable region needs to have a unique identifier, so make sure you aren't using the same exact code to create each editable region. <?php $FP->Cms->display_block('unique-id-here'); ?>
  16. Unfortunately, it's not possible to set a default value on file fields. See http://bytes.com/topic/php/answers/906666-how-set-default-value-input-type-file-field-html, http://stackoverflow.com/questions/2665058/set-default-value-for-a-input-file-form and similar.
  17. Sorry, it doesn't work that way. A PSD is a Photoshop file -- a design that is usually sliced into multiple separate image files and used in the website's HTML code. You really can't go backward without recreating the PSD from scratch.
  18. Yes, it's OK to use multiple stylesheets. However, I don't really see any problem with using a single stylesheet that controls multiple page layouts. For example, you could add a class to the body tag on the page that would indicate the layout you are using on that page, then use that class when adding styling. For example: .layout1 #header { ...one set of styles for the header in layout #1... } .layout2 #header { ...another set of styles for the header in layout #2... }
  19. Can you do it? Yes. Should you do it? (and I'm talking about doing full websites, but just minor updates here and there) ...surely you'd be more productive with a proper sized screen? That said, see: https://itunes.apple.com/gb/app/id364906873?mt=8&affId=1709650&ign-mpt=uo%3D6 https://itunes.apple.com/gb/app/id421507115?mt=8&affId=1709650&ign-mpt=uo%3D6 http://www.panic.com/dietcoda/ http://webdesign.tutsplus.com/tutorials/workflow-tutorials/build-a-complete-website-on-an-ipad/ http://www.awwwards.com/23-essential-ipad-apps-for-web-designers-and-developers.html
  20. I don't think there is a big advantage either way -- ultimately it does the same thing.
  21. I think the key issue is where you are defining the variables -- as properties within a class. From the documentation (http://php.net/manual/en/language.oop5.properties.php): In short, you can assign a class property a specific value, but it can't be based on another variable -- at least, not where you are currently defining that property within the class. An alternate way around this would be to the setting of values within the __construct() method: class pagination { private $limit = 30; private $start = 0; private $eu; private $space; private $this1; private $back; private $next; private $k; public $beg; public $end; function __construct($persons_name) { $this->eu = $this->start - 0; $this->this1 = $this->eu - $this->limit; ...etc... }
  22. What are you trying to do with a .jar file? A .jar file is Java based, whereas a .php file is PHP -- two separate languages?
  23. In and of itself, that doesn't do anything. However, if you were to create an object: $person = new person(); $person->set_name('Bob'); echo $person->get_name(); you can use that method to set the name. $new_name has a value of whatever is passed into the set_name method when it is called (for example, "Bob").
  24. falkencreative

    Class Person

    Those are two separate things. The "class person" is an example of object oriented programming (OOP) -- it's a design pattern, and can be used as an organizational structure to create an object that retrieves information from a form and processes it... but in and of itself, OOP can't do what you are after. To retrieve data from a form, you'd need to use $_POST[] and to send it to the database, you'd need to use a connection to a database (MySQL, MySQLi or PDO) and an SQL "insert" command. I wrote an example application that adds/deletes and edits data from a database. Might be worth checking out to help you get started? http://www.killersites.com/community/index.php?/topic/3064-basic-php-system-view-edit-add-delete-records-with-mysqli/
×
×
  • Create New...