Jump to content

Post data


graham23s

Recommended Posts

Hi Guys,

 

im writing a small forum here, i have used a get to grab the button input to post a message, then it goes to a screen to post the data into mysql but im not sure the best way to deal with the post data once submitted:

 

<?php
     // grab the id...///////////////////////////////////////////////////////////////////
     $forum_id = $_GET['id'];
     
     ## the gets ########################################################################
     if ($_GET['action'] == "newtopic") {
     
     ## forum id ########################################################################
     $forumid = $_GET['forumid'];
     
     ## make the new topic box ##########################################################
     echo '<br />';
     echo '<b>Adding a new topic in the forum: </b>';
     echo '<br /><br />
           <table width=80% border=1 cellspacing=0 cellpadding=10><tr><td align=center>
           <form method="POST" action="?action="post">
           <input type="hidden" name="forumid" value='.$forumid.'>
           <table class="forum_border" border=1 cellspacing=0 cellpadding=5>
           <tr>
           <td class="forum_border"><b>Subject</b></td><td class="forum_border" align=left style=\'padding: 0px\'><input type=text size=100 maxlength=40 name=subject style=\'border: 0px; height: 19px\'></td>
           </tr>
           <tr>
           <td class="forum_border" align="right" valign="top"><b>Body</b></td><td class="forum_border" align=left style=\'padding: 0px\'><textarea name="body" cols="100" rows="20" style=\'border: 0px\'></textarea></td>
           </tr>
           <tr>
           <td class="forum_border" colspan=2 align=center><input type=submit class=btn value=\'Submit Topic\'></td>
           </tr>
           </td>
           </tr>
           </table>
           </form>    
           </table><br />';
     
     include("includes/footer.php");
     exit;
     
     }
     
     if ($_GET['action'] == "post") {
     
     
     }
     
     ## forum name ######################################################################
     $forum_query = "SELECT * FROM `forum_sections` WHERE `id`='$forum_id'";
     $forum_result = mysql_query($forum_query) or die (mysql_error());
     $row = mysql_fetch_array($forum_result) or die (mysql_error());
     
     ## vars ############################################################################
     $forum_name = $row['forumname'];
     
     ## echo ############################################################################
     echo "<br /><h3>$forum_name</h3>";
     
     
     ## buttons #########################################################################
     echo '<form method="get" action=?><input type="hidden" name="action" value="newtopic"><input type="hidden" name="forumid" value="'.$forum_id.'"><input type=submit value=\'New Topic\' class=btn style=\'margin-left: 10px\'></form>';
?>

 

 

any advice would be appreciated.

 

cheers

 

Graham

Link to comment
https://forums.phpfreaks.com/topic/65506-post-data/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.