Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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