Home arrow PHP arrow Page 3 - Handling Entries for a Blogger Built with PHP

Defining the displayInsertForm() method - PHP

Are you searching for an accessible guide on how to create a blog application with PHP 5? Then this set of articles might be what you’ve been looking for! Welcome to the second part of the series “Building a Blogger with PHP.” In three parts, this series demonstrates in a few easy steps how to build a classic blog application in PHP 5 by following an object-oriented approach.

TABLE OF CONTENTS:
  1. Handling Entries for a Blogger Built with PHP
  2. Defining the displayBlogs() method
  3. Defining the displayInsertForm() method
  4. Creating the displayUpdateForm() method
  5. Defining the displayHeader() and displayFooter() methods
By: Alejandro Gervasio
Rating: starstarstarstarstar / 3
November 28, 2006

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

As I explained in the previous section, the next few lines will be entirely focused on showing how to create a new class method for displaying the respective online form where users can add new blog entries that will be shown on the application's main page.

Given that, here is the definition of this useful method, which I named "displayInsertForm()." Its signature is as follows:

// display insertion form
private function displayInsertForm(){
            $output=<<<EOD
<div class="dataform">
<h2>Insert New Blog</h2>
<form action="$_SERVER[PHP_SELF]" method="post" id="insertform">
<p>Title:</p><p><input type="text" name="title"
class="datafield" /></p>
<p>Author:</p><p><input type="text" name="author"
class="datafield" /></p>
<p>Type your content below</p><p><textarea
name="content"></textarea></p>
<p><input type="submit" name="insertblog" value="Insert
Blog" /></p>
</form>
</div>
EOD;
            return $output;  
}

In this case, the method listed above is simply tasked with rendering an input form which contains the typical boxes for entering basic blog data, such as the blog's title, author and content.

As you can see, there's nothing unexpected concerning the previous method, so let's move on and see another one. This method will be aimed at displaying the respective online form that allows the updating of a particular blog entry.

The topic sounds really interesting, right? Therefore, go ahead and jump into the following section. I'll be there, waiting for you.



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: