0

Hello im not too sure how is this called but i will try to explain.. I want to make the form to get updated on every "Status Update" so for ex. like Facebook when you are posting a new status it gets updated the "body" of the page with new "Updated FORM Box", so if anyone can tell me how its called that so i can search around the internet and find some good stuff or someone give me an example how is done that ?
Thanks :)

2
Contributors
4
Replies
39
Views
2 Years
Discussion Span
Last Post by Taywin
0

I have this code but this is just the look of the "Status update box"

<html>
    <body>
        <style>
            textarea.status-box {
                opacity:1;
                border-radius:9px;
                background-color: #E6FFFF;
                border:2px solid gray;
            }
            input.sBtn {
                opacity:1;
                position: relative;
                border-radius:9px;
                width:100px;
                height:35px;
                right: 34%;
                background-color: #E6FF8F;
                border:2px solid gray;
            }
            div.updated-box {
                opacity:1;
                position: relative;
                border-radius:9px;
                background-color: #E6FFFF;
                border:2px solid gray;
            }
        </style>
        <center>
            <div style="opacity:1; border-radius:10px; width:500px; left:20%; top:20%; height:180px; background-color:white; border:3px solid gray;"><br>
                <form action="index.php" method="GET" name="update-status_form">
                    <textarea class="status-box" type="text" name="status-box" rows="6" cols="60" placeholder="What you thinking of ?"></textarea><br><br>
                    <input class="sBtn" type="submit" value="Post"/>
                </form>
                <?php
                    $date = date('H:m:s');


                    if(isset($_GET['status-box'])) {
                        $update = $_GET['status-box'];  
                        echo "
                            <br><br>
                            <div class='updated-box'>
                                <br><br><a>$update</a><hr>
                                Posted on: $date
                            </div>";
                    }
                ?>
            </div>
        </center>
    </body>
</html>
0

Your current snippet shows that you simply display whatever the user puts in the textarea, but the content will never be stored. As a result, the content will disappear everytime the user click 'Post' again. Do you have any database on your backend (server)? You need to save the content from the user after you see that there is something posted.

By the way, you need to sanitize user input as well. In this case, your current snippet is obviously vulnerable to XSS (Cross Site Scripting) attack...

0

Yup i have a database on Godaddy but i still cannot figure out how to make it :D
BTW i need every new post is posted to go on top of the last post so i think this make sense :D

Edited by Stefan_1

0

Hmm... Then you would first need to look at how to set up your SQL server on your backend. Then look at how to connect to it using PHP. Then you may want to look at AJAX for instant update and display on your page.

For now, you may need to set up your SQL to run first. It could be any type (MySQL, Postgre, etc.). Then you will need some information from the database server (i.e. IP of the server to connect to, username & password, database name, etc.). All of these will be used to connect to the server in your PHP script.

Once you get your database up and obtain all information for connection, you will need to connect to the database and retrieve previous posts related to the status you want to link. This part shouldn't be too difficult for you. There are plenty of examples on this site or the Internet (including how to do it with AJAX).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.