Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 how to post form
Index -> Graphics and Design, Web Design -> (X)HTML Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
QuantumPhysics




PostPosted: Fri Feb 08, 2013 9:31 pm   Post subject: how to post form

I have a textbox form and list values. I am looking for guidance or possibly a tutorial.
Basically I need help to write a PHP script so that when someone types text in the box and enters the values on the screen it will post that onto another html page on the same website. This has to be down for multiple times. And after 10 posts are made on the page it makes a link on that page to another page like on a forums at the bottom you can select which page to view 1, 2, 3, 4, 5... 999
I really need some serious help with this and fast. I am willing to pay for assistance via paypal. Thanks

Let me know if you need more information at what I need..
Sponsor
Sponsor
Sponsor
sponsor
joshm




PostPosted: Sat Feb 09, 2013 10:39 am   Post subject: RE:how to post form

You're going to need to first store the posts. This can be an sql database or text file. Once you've stored the files you then need to retrieve them and display them.

Since you only want to display 10 per page you could make a variable to retrieve the 10 most recent post id's and add another page each time 10 posts is exceeded.
QuantumPhysics




PostPosted: Sat Feb 09, 2013 5:38 pm   Post subject: RE:how to post form

Well I thought of that... but how do i do it?
joshm




PostPosted: Sat Feb 09, 2013 7:34 pm   Post subject: Re: how to post form

Ok here's a simple example.

I created a database called messages, which stores a msg and msg_id

index.php

code:

<html>
<body>

<form name="post_msg" action="submit_msg.php" method="post">
        Ur msg: <input type="text" name="msg" maxlength="30" /><br />
        <input type="submit" value="submit" />
</form>

<?php
        echo "Here are some msgs<br/>";
        //Retrieve and display the msgs
        $conn = mysql_connect('localhost:3306', 'root', '' );
        mysql_select_db('messages', $conn);
        $query = "SELECT `msg` FROM `saved_msgs`;";
        $result = mysql_query($query);
        while ($msgs = mysql_fetch_array($result))
                echo $msgs['msg']."<br/>";     
?>

</body>
</html>


and the submit_msg.php

code:

<?php
        //Get ur msg
        $msg = htmlspecialchars($_POST['msg']);
        //Connect to ur db
        $conn = mysql_connect('localhost:3306', 'root', '' );
        mysql_select_db('messages', $conn);
        $query = "INSERT INTO saved_msgs ( msg ) VALUES ( '$msg' );";
        mysql_query($query);
        mysql_close();
        header('Location: index.php');
?>
QuantumPhysics




PostPosted: Sun Feb 10, 2013 5:21 am   Post subject: RE:how to post form

Wow! Thank you so much. ++karma
Display posts from previous:   
   Index -> Graphics and Design, Web Design -> (X)HTML Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: