   [web] Forum post submit button.
  I'm having a problem figuring out how to get my submit button to work right, basically the submit button calls a java script function which is suppose to write the post into a database but the only way I know to do this is with php. I tried this though I knew it would not work:<script type="text/javascript">function submit(){<?phpmysql_query("INSERT INTO posts ( id, parent_id, category_id, user_id, subject, message, sticky, allow_post )VALUES('3','3','1','1','Hi','Hi again','1','1')" );?>window.location="view_category.php?cat=<?php echo($cat_id); ?>";}</script>How can I do this since php is server side and java is client side?   
  Use an XMLRequest in &#106avascript to call a 'post.php' file.Personally I would use jquery;Quote:Original post by SteveDeFacto...I'm having a problem figuring out how to get my submit button to work right, basically the submit button calls a java script function which is suppose to write the post into a database but the only way I know to do this is with php...Your submit button has to call a php script on the server to do something in PHP. You have two options, first is using plain HTML formular elements, second is using an AJAX POST (with &#106avascript). You're a beginner, so stick with the basics first:Learn some HTML formular syntax, which does POST requests. For example you could output the following:<form action="post.php" method="POST">  <input type="text" name="mytopic" />  <input type="text" name="mymessage" />  <input type="submit" value="submit" /></form>Than learn how to access POST environment variables a php script can access when called with this method. For example the php file could do something like this:<?php// if the script file gets called by hitting the submit button than// the $_POST array got set by the php interpreterif (isset($_POST['mymessage'])) {  echo($_POST['mymessage']);}?>;  I used the form method it works perfect. thanks man.   