Jump to content
Old threads will finally start getting archived ×

phpFirstJoy

Members
  • Posts

    32
  • Joined

Everything posted by phpFirstJoy

  1. Hi again, I have another question that I would like to ask. This time it's about classes. Now, I know how great OOP is and all but I tend to have a class for statistical logging, user functions, authenticating users, error logging, page templating, database methods, page caching, and I'm sure I can come up with a much longer list. The problem I'm encountering is that I need almost all these classes on nearly every page. So when a page is called up, it loads most of the classes and whatever else I've included before running them and finally displaying the page. This makes loading time really slow. How would I improve page loading? Are there some classes that I should get rid of? Maybe I'm not designing my classes correctly? All of the above? I'd appreciate the help. Thanks!
  2. Oh, ok. Thanks!
  3. But wouldn't it affect the time it takes to load/process or something of the sort depending on which method I use? :-\
  4. Mmmm I think I'll just copy and paste the example from the manual: <form action="foo.php" method="post"> Name: <input type="text" name="username" /><br /> Email: <input type="text" name="email" /><br /> <input type="submit" name="submit" value="Submit me!" /> </form> Let's assume that the form above is located in SuperDuper.php. So when SuperDuper.php loads, the form appears in the browser. When the user enters in the data and then clicks submit, the data is then "posted" to foo.php. foo.php has some coding that processes the data entered from the user. This is what the manual does but what I normally do is the following: <form action="SuperDuper.php" method="post"> Name: <input type="text" name="username" /><br /> Email: <input type="text" name="email" /><br /> <input type="hidden" name="status" value="submitted" /> <input type="submit" name="submit" value="Submit me!" /> </form> So the above form is still in SuperDuper.php but when the user clicks submit, the data is "posted" to SuperDuper.php (note the hidden field). There's some script/code at the beginning of SuperDuper.php that checks to see if the form was submitted by the user. If so, it processes the user entered data. It doesn't call upon another script (such as foo.php). It does everything in this one file. Which method of programming is better? I hope that clears up any confusion! :-\
  5. Hi, I was reading the PHP manual and came across a form example where the action redirects to a separate PHP script file. I'm just wondering if this is the better way to do it? I normally put everything in the same file as my form. For example, if I have a MakePost.php file, that one file will contain the form, the script, everything. Should I make another file like addpostscript.php and then in my MakePost.php, redirect the action to addpostscript.php? I hope this makes sense! ??? -- Unsure
×
×
  • 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.