Jump to content

tgavin

Members
  • Posts

    176
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://timgavin.name

Profile Information

  • Gender
    Male
  • Location
    Naples, FL

tgavin's Achievements

Member

Member (2/5)

1

Reputation

  1. I'm digging into this and am getting a better understanding of how this works - thank you guys for pointing it out to me - I can totally see the value of this! I'm curious though about the FormInterface... class? interface? What does that do? I can build my forms with all of the arguments right inside the Form class, so why are those additional methods set inside FormInterface?
  2. Excellent advice. This is the way I'm going to go. Thanks guys!
  3. Thanks for your help guys. Before I try any of this, I'm thinking: what about just doing the following class Forms extends Bootstrap { .... } Seems simple enough, and works! Would there be any problems with this?
  4. You know, 'Bootstrap extends Forms' is pretty much the first thing I tried, but I didn't want to create a new $bs object, because I wanted to keep it simple and use the $form object for everything. I know it's only the difference in typing $form-> vs. $bs->, but it's easy to forget when you're on a roll. So, if I don't want to create a new object, is my only option to put all of the bootstrap methods in the Forms class? Thanks!
  5. I have a class for building forms and I want to upgrade it to handle Bootstrap. I'd like to use my current methods to build the Bootstrap elements, but I don't want all of this new Bootstrap code cluttering up my current Forms class, so I'd like to put it into its own class in a separate file. Below is a very simple example of what I'm trying to do. Obviously this doesn't work and the code is wrong, however, from this you can hopefully see what I'm trying to accomplish. <?php class Forms { public function input_text($name) { return '<input type="text" name="'.$name.'">'; } } class Bootstrap { public function bootstrap_input_text($name) { $return = '<div class="control-group">'; $return .= '<label class="control-label" for="'.$name.'">First name</label>'; $return .= '<div class="controls">'; $return .= $this->Forms->input_text($name); $return .= '</div>'; $return .= '</div>'; return $return; } } $form = new Forms(); echo $form->bootstrap_input_text('fname');
  6. Thanks guys, Those were the first things I tried actually. Neither of your examples loop through the $types array and display ALL of the types. I don't want to only display the types that are only in the database, I want to display ALL types, and then highlight the type that's ALSO in the database. it's a checklist to show the user the list of documents, plus what's been uploaded and what hasn't. For instance, let's say PDF and Word are found in the database, my printed result would look like this Word (uploaded) Excel PDF (uploaded)
  7. I have an array of document types that I need to display, and then visually show if that type has been uploaded into the database. The code below works, but it's obviously not ideal. it's probably the best way to show you want I want to accomplish though. I'm trying to find a better, more efficient way of doing this without having to make so many queries. Any thoughts? $types = array('Word','Excel','PDF'); foreach($types as $type) { if($db->get_row("SELECT doctype FROM documents WHERE doctype ='$type' AND id = 100")) { echo $type.' (uploaded)<br>'; } else { echo $type.'<br>'; } }
  8. PFMaBiSmAd: Excellent catch! I'm implementing a system that a previous developer had created and he's using bullcrap shortcuts all over the place. Very lazy and insecure. That fixed it, thank you!
  9. I'm encountering a weird one on IIS with PHP 5.4.7 in my script I'm trying to include my config.php file (located in the same directory), so I put require_once('config.php'); as I normally would on Linux. Well, later in my script I'm getting an undefined variable notice, even though the var has been defined in config.php. So I open config.php and do this $base_dir = 'www'; var_dump($base_dir); exit; now, not only do I now see a result from the var_dump, the script doesn't die as it should, and I continue receiving the undefined variable notice at the same point in the script. WTH? Even if I do require_once('config.php); var_dump($base_dir); exit; I get no results - just the undefined var error. it's almost like the config.php file isn't being included. Any ideas?
  10. I know you say the queries are fine, but did you actually check them in phpmyadmin?
  11. I must not be understanding something, because it looks to me it's doing exactly what you're telling it to do. Try this and see if anything changes if($q2_cycle_oil_count > 0) instead of if ($q2_cycle_oil_count >= 1)
  12. apparently it's not empty. what do you get when you run the query in phpmyadmin?
  13. Check your query. Test it in phpmyadmin and make sure you're getting the results you want first. then bring it back into your script.
  14. What does this produce? $count = mysql_num_rows($q1_cycle_oil_results); echo $count;
  15. Thank you. i was too close. this solved the problem. $name = rtrim($data['name'],'[]');
×
×
  • 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.