+ Reply to Thread
Results 1 to 2 of 2
Like Tree2Likes
  • 2 Post By thespeshulk

Thread: Use PHP to add Content to page through Admin

  1. #1
    goldy30's Avatar
    goldy30 is offline x10Hosting Member goldy30 is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    60

    Question Use PHP to add Content to page through Admin

    I'm doing my final website for TAFE but I'm very sketchy on my php. We done it for 2 weeks months ago and haven't used it since. Now I need to start working on my site using php but I have no idea!

    Anyway, I want to allow my admin to access a 'manage pages' link and see through a form the content that is displayed from the database.

    By entering the title of the page through an input they will alter the title of the page in the front end. They would also be able to add or edit the text on the page through a text area.

    Once the information is in the database the content should reflect back into the form fields so admin can see what they are editing.

    I have a 'pages' table in the database which consists of 4 fields; pages_id, pagename, title and blurb.

    I'd assume I'd have to echo back what is in the database on the page where I want the text to appear.

    I'm not sure what other info you need but heres the form.
    HTML Code:
    <form action="" method="post" name="">                    
                    
                        <table cellpadding="10px" width="400" height="100px" border="0" bordercolor="" cellspacing="0">
                            
                            <tr>
                                <td>
                                    Select Page:<br> 
    
                                    <select name="selectpage">
                                        <option value="index">Home</option>
                                        <option value="viewpetition">View Petitions</option>
                                        <option value="startpetition">Start a Petition</option>
                                        <option value="howtopetition">How to write a petition</option>
                                        <option value="resources">Government Resources</option>
                                        <option value="contact">Contact Us</option>
                                        <option value="privacy">Privacy Statement</option>
                                        <option value="about">About Us</option>
                                        <option value="about">New Page</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Title:<br> <input type="text" name="index_title"  size="40">
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Page Info:<br>
                                    <textarea name="index_content"  rows="7" cols="60"></textarea><br>
                                    
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input type="image" src="images/save.gif">
                                </td>
                            
                            </tr>
                        </table>
    
            </form>
    I appreciate any help or direction anyone can give me. Playing with this will also get the PHP wheels in my head cranking again.

    Thanks.

  2. #2
    thespeshulk is offline x10Hosting Member thespeshulk is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    9

    Re: Use PHP to add Content to page through Admin

    The easiest to do this, if I'm understanding right what it is you're trying to accomplish, to grab the page's content from the database and store it in an associative array. If you are using basic mysql functions this will be something like:
    $query="mysql query";
    $result=mysql_query($query);
    $row=mysql_fetch_assoc($result);
    This will return an array with the indexes as the fields and the values as the content associated with the field.

    When you submit the form you will probably want to send the data to a php file that will process the information and update the database. if you have any questions on a mysql function just google mysql and the function or the action you want to do and you should get good results. As for the PhP side try checking out php.net for a list of all of php's functions. (its how i got started =) )
    dinomirt96 and karimirt47 like this.

+ Reply to Thread

Similar Threads

  1. Places to learn php
    By JaWasabi in forum Scripts & 3rd Party Apps
    Replies: 9
    Last Post: 01-13-2009, 02:03 AM
  2. Help Setting Up PHP Quick Admin
    By cosmicsafari in forum Scripts & 3rd Party Apps
    Replies: 3
    Last Post: 06-04-2008, 07:29 AM
  3. PHP Nuke 7.9 doesn't display on home page?
    By themasterrocker in forum Scripts & 3rd Party Apps
    Replies: 0
    Last Post: 05-26-2008, 02:37 PM
  4. "PHP Startup: Invalid Library" - Interesting error
    By javaguy78 in forum Free Hosting
    Replies: 5
    Last Post: 03-27-2007, 02:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers