Hi all, I've finally gotten a handle on object-oriented programming (it took ages), and I really like it. But I'm still struggling with conceptualizing some things. For example, if I want to make a form using objects, do I make a Form class with a method like startFORM($name_of_action_page, $method), then another method like inputBox($name_of_box), etc. until I get to closeFORM(). Lets say I do it this way, then if I want to put the form in a table to straight things out, do I place the methods in between the html tags <td></td>. If I do that, where do I put the TRY and CATCH statements. Or do I have to use them? I want to make a drop down box and be able to populate it with whatever I place in the parameters. Is that how I would do it? All of the books I've been looking at are about big classes, XMLWriter, but what I need is more about how to use objects and classes on basic things on a website. Thanks for the help.
Pado
0
Light Poster
Recommended Answers
Jump to PostIs this a php or javascript question because aren't the try and catch statements part of the javascript language. If that is the case then perhaps you are posting in the wrong section. Also could you please send some code to explain your question.
From what I can understand in …
Jump to PostThis is definitely a PHP question. Here's a code sample of what I'm talking about:
try { $product = new Categories(DB_SERVER, DB_USER, DB_PASS, DB_NAME); $product->setCategoryName($categoryName); $product->setTableName("$tableValue"); $product->readKeyArray($keyArray, $valueArray); $product->enterCategoryInDB(); $product->getCategoryID(); } catch (Exception $e) { echo $e->getMessage(); }
Is this kind of coding only meant for the testing of …
All 6 Replies
cwarn23
387
Occupation: Genius
Team Colleague
Featured Poster
Pado
0
Light Poster
Stefano Mtangoo
455
Senior Poster
cwarn23
387
Occupation: Genius
Team Colleague
Featured Poster
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
Stefano Mtangoo
455
Senior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.