Jump to content

andrew_biggart

Members
  • Posts

    363
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by andrew_biggart

  1. and my control.php is the following! <?php require_once 'php/class.GuestBook.php'; $guestbook = new GuestBook('Biggart_GuestbookT'); function insertPost() { global $guestbook; return $guestbook->insert($_POST); } function editPost() { global $guestbook; return $guestbook->update($_POST); } function getSinglePost(){ global $guestbook; return $guestbook->getPost($_GET['id']); } function getPage() { global $guestbook; return $guestbook->getPostList(); } function removePost(){ global $guestbook; return $guestbook->removePost($_GET['id']); } echo $_GET['action']();[code] [/code]
  2. OK so i have tried doing it this way but the insert post part of it doesn't work, it adds the name and comment but in the address bar and not the database. Can someone please point me in the right direction? <?php //Set no caching header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); ?> window.addEvent('domready',domReady); function domReady(){ var guestbook = new GuestBook(); } GuestBook = new Class({ initialize: function(){ $('newComment').addEvent('submit', this.addComment); }, addComment: function(e){ e.preventDefault(); var req = new Request({ url:'control.php?action=insertPost', onSuccess:commentAddSuccess }).post(this); function commentAddSuccess(idNo){ new Element('span',{ 'text':'inserted item ' + idNo }).inject($('newComment')); } }, }); var guestbook; window.addEvent('domready', function(){ guestbook = new GuestBook(); }); var GuestBook = new Class({ initialize: function(){ var req = new Request.JSON({ url: 'control.php?action=getPage', onSuccess: this.success }).send(); }, success: function(jArray){ jArray.each(function(post){ var post = new PostItem(post.id, post.name, post.comment); post.display().inject($('commentList')); }, this); } }); var PostItem = new Class({ initialize: function(id, name, comment){ this.id = id; this.name = name; this.comment = comment; }, display: function(){ var cont = new Element('div',{ 'class':'postItem', 'id':'post'+this.id }); var title = new Element('h3',{ 'class':'postTitle', 'text':this.name + ' says...' }); var comment = new Element('p',{ 'class':'postComment', 'text':this.comment }); title.inject(cont); comment.inject(cont); return cont; } });
  3. Ok what i am trying to do is basically i have to pages... one to read the comments and one to insert a comment for a simple guestbook. But i want the two pages to run off the same page. Im using the following code. read.js <?php //Set no caching header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); ?> var guestbook; window.addEvent('domready', function(){ guestbook = new GuestBook(); }); var GuestBook = new Class({ initialize: function(){ var req = new Request.JSON({ url: 'control.php?action=getPage', onSuccess: this.success }).send(); }, success: function(jArray){ jArray.each(function(post){ var post = new PostItem(post.id, post.name, post.comment); post.display().inject($('commentList')); }, this); } }); var PostItem = new Class({ initialize: function(id, name, comment){ this.id = id; this.name = name; this.comment = comment; }, display: function(){ var cont = new Element('div',{ 'class':'postItem', 'id':'post'+this.id }); var title = new Element('h3',{ 'class':'postTitle', 'text':this.name + ' says...' }); var comment = new Element('p',{ 'class':'postComment', 'text':this.comment }); title.inject(cont); comment.inject(cont); return cont; } }); readposts.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled 2</title> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <link href="layout.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/mootools.js"></script> <script type="text/javascript" src="js/read.php"></script> </head> <body> <div id="wrapper"> <div id="masthead"> Andrews Guestbook </div> <div id="top_nav"> <a href="readposts.php">Read posts</a> | <a href="insertpost.php">Insert Post</a> | <a href="editpost.php">Edit post</a> | <a href="deletepost.php">Delete Post</a> </div> <div id="page_content"> <h1>Andrews Guestbook</h1> <div id="commentList"> </div> </div> <div id="footer"> © Andrew Biggart 2009 -2010 </div> </div> </body> </html> and then we have the insert files insert.js <?php //Set no caching header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); ?> window.addEvent('domready',domReady); function domReady(){ var guestbook = new GuestBook(); } GuestBook = new Class({ initialize: function(){ $('newComment').addEvent('submit', this.addComment); }, addComment: function(e){ e.preventDefault(); var req = new Request({ url:'control.php?action=insertPost', onSuccess:commentAddSuccess }).post(this); function commentAddSuccess(idNo){ new Element('span',{ 'text':'inserted item ' + idNo }).inject($('newComment')); } }, }); and finally insertpost.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled 2</title> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <link href="layout.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/mootools.js"></script> <script type="text/javascript" src="js/insert.php"></script> </head> <body> <div id="wrapper"> <div id="masthead"> Andrews Guestbook </div> <div id="top_nav"> <a href="readposts.php">Read posts</a> | <a href="insertpost.php">Insert Post</a> | <a href="editpost.php">Edit post</a> | <a href="deletepost.php">Delete Post</a> </div> <div id="page_content"> <h1>Insert Post into Guestbook</h1> <form id="newComment" action="#"> <div><label>Name: </label> <input type="text" name="name"/> </div> <div><label>Comment: </label> <textarea name="comment"></textarea> </div> <div><input type="submit" value="Add comment"/></div> </form> </div> <div id="footer"> © Andrew Biggart 2009 -2010 </div> </div> </body> </html> I am after some advice as to how i would go about making both of these pages running off the same page. Thanks
  4. Yea well basically i have been given all that code and i have to get everthing running off one page for a pass. I know that i have to use the get command to find out what action to do and then use a massive if statement for all the functions but i dont know where to start! And yes the module is ajax so i do have to use it!
  5. can anyone please help me with this? it has be in in 3 days and i havent even got it started? please? any help would be aprreciated thanks
  6. Sorry to be annoying keith but could you explain this to me abit more as i dont know whee to start please!
  7. Ok i am trying to create a forum, and i have got to the stage of the most popular posts! The way i have it set up is i have the original posts in one table and then the comments in another table! The posts have a primary key of post_id and the comments have a primary key of comment_id but it also has a column called post id to link the 2 tables together. But what i want to do is count which posts have the most comments from the comment table, and then when i have those say 5 results select the 5 posts from the post table by their post id! I cant gat my head around how i would go about starting this so any help will be appreciated thanks! Hopefully i have it explained what i want to do ok.
  8. Is this the easiest way to do it? can flsh not check if a session is registered by itself?
  9. Ok what i am trying to do is test for a registered session in flash (myusername) and if it is not set then goto and play frame 1! but if it is registered goto and play frame 80. Can anyone point me in the right direction? Thanks
  10. Ok what i am trying to do is test for a registered session in flash (myusername) and if it is not set then start playing from goto and play frame 1! but if it is registered goto and play frame 80. Can anyone point me in the right direction? Thanks
  11. Is there anywhere on this site for flash help? i cant seem to find it! sorry for posting here!
  12. ok i have now noticed it is actually changing the information but giving the error so does that mean it is something to do with the server?
  13. its saying this now! with the above code!! Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, root@server.microlite20.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.
  14. I have also tried doing this way but im having no success i just cannot see what i am doing wrong!!! <?php session_start(); if(isset($_SESSION['myusername'])) { } else{ header("location:login.php"); } // Check the user is logged in ?> <?php include("config.php"); $Username=$_SESSION['myusername']; $Location = ($_POST['Location']); $Fav = ($_POST['Fav']); $Quote = ($_POST['Quote']); $Interests = ($_POST['Interests']); $Happy = ($_POST['Happy']); $Sad = ($_POST['Sad']); $Habits = ($_POST['Habits']); $Music = ($_POST['Music']); $Movie = ($_POST['Movie']); $Website = ($_POST['Website']); $Aboutme = ($_POST['Aboutme']); $Whywe = ($_POST['Whywe']); $Status = ($_POST['status']); $sql = "UPDATE User_infoT SET Location='$Location', Fav='$Fav', Quote='$Quote', Interests='$Interests', Happy='$Happy', Sad='$Sad', Habits='$Habits', Music='$Music', Movie='$Movie', Website='$Website', Aboutme='$Aboutme', Whywe='$Whywe', Status='$Status' WHERE Username='$Username'"; $result=mysql_query($sql) or die(mysql_error().": $sql"); if($result){ header("my_profile.php"); } else { header("profile_edit.php"); } // close connection mysql_close(); ?>
  15. This is the php code i am using now! can anyone spot an error? <?php session_start(); if(isset($_SESSION['myusername'])) { } else{ header("location:login.php"); } // Check the user is logged in ?> <?php include("config.php"); $username=$_SESSION['myusername']; $Location = ($_POST['Location']); $Fav = ($_POST['Fav']); $Quote = ($_POST['Quote']); $Interests = ($_POST['Interests']); $Happy = ($_POST['Happy']); $Sad = ($_POST['Sad']); $Habits = ($_POST['Habits']); $Music = ($_POST['Music']); $Movie = ($_POST['Movie']); $Website = ($_POST['Website']); $Aboutme = ($_POST['Aboutme']); $Whywe = ($_POST['Whywe']); $Status = ($_POST['status']); $sql = "UPDATE User_infoT ( Location, Fav, Quote, Interests, Happy, Sad, Habits, Music, Movie, Website, Aboutme, Whywe, Status) VALUES( '$Location', '$Fav', '$Quote', '$Interests', '$Happy', '$Sad', '$Habits' , '$Music', '$Movie', '$Website', '$Aboutme', '$Whywe', '$Status' ) WHERE Username='$username'"; $result=mysql_query($sql); if($result){ header("my_profile.php"); } else { header("profile_edit.php"); } // close connection mysql_close(); ?>
  16. this is the error i am now getting on screen !! You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '( Location, Fav, Quote, Interests, Happy, Sad, Habits, Music, Movie, Website, Ab' at line 1: UPDATE User_infoT ( Location, Fav, Quote, Interests, Happy, Sad, Habits, Music, Movie, Website, Aboutme, Whywe, Status) VALUES( 'Manchester, UK', 'Choose', 'I like a blunt or a big fat cone, but this double barelled bong is getting me stoned!', 'Webdesigning, Numbing myself & dressing up like a hotdog', 'When this site runs smothly & i can just chillax', 'Spammers, cheap skates & hackers', 'Sitting up all night smoking and sleeping all day' , 'Choose', 'Half Baked & Pineapple express', 'http://www.andrewbiggart.co.uk', 'I\'m about as random as a banana boat on steroids! Yes i am Irish, and yes I will drink & smoke with you until I pass out! I love piercings and tattoo\'s, they really tickle my pickle! Couldn\'t really give a shit if people like me on hear, if you dont like it dont fucking use the site, im not gaining anything or losing anything by you being hear or not ! Cant be bothered with game players, knob ends and stuck up people! so don\'t bother messaging me And also if u have to pull your head out of your own ass to talk to me don\'t bother Ive got no time for people who love their self more than they could ever love anyone else Ive been smoking the sweet stuff for far far far to long now, but im now a part time smoker instead of an every minute of every hour or every second smoker. I realised if u want to get anything done in life u need to lay off the web abit to be honest otherwise you will never get out of your boxers & never stop playing xbox. Loving the new kings of leon album P.S Kayne West-Heartless is the shinizzle ', 'Because i like to be numb! I like to smoke this shit as it makes me cretive as fuck, i mean look at this site for an example! Would a non-pothead have had the patients to crete this shit i dont think so lol It is always a very good way to chil a mother fucker out if he is stressed to the eyeballs, girlfriends on his back, boss is trying to hump his leg etc etc! Im so feed up with this bullshit the government has put on the news about weed and had it raised to a class B drug again, did someone say scare tactics? This world needs to wake up and realise we are being controlled far to fucking much, free will & freedom of spek my fucking ass. As Bill Hicks once said, Why is marijuana against the law? It grows naturally upon our planet. Doesn\'t the idea of making nature against the law seem to you a bit . . . unnatural', 'Is sitting in his boxers playing xbox smoking lungs! 222222' ) WHERE Username='AdMiN'
  17. Ok i have literally been trying to get this to work since i have came out of the womb, well it feels like that..... But im just trying to get a simple update your profile page working. So i have this form which echo's the current info to the text boxes and then you can change what you want. Editprofile.php <table class="myprofile_change"> <tr><td class="myprofile_changesh">Edit Profile</td></tr> <tr><td class="myprofile_subtext2">Scroll down, complete the fields, then click Save Changes to update your profile. All of the following questions are optional, but you must answer a minimum of 5 to appear in our search results.</td></tr> <tr><td></td></tr> </table> <br /> <table> <tr><td class="myprofile_changesh">General Info ...</td></tr> </table> <form method="post" action="my_profile_edit_submit.php"> <?php include("config.php"); // Retrieve data from database $sql="SELECT * FROM User_infoT WHERE Username='".$_SESSION["myusername"]. "'"; $result=mysql_query($sql); // Start looping rows in mysql database. while($rows=mysql_fetch_array($result)){ ?> <table class="myprofile_change"> <tr><td class="myprofile_subtext">Your Status :</td><td> <input name="status" id="status" type="text" value="<? echo $rows['Status']; ?>" style="width: 417px" /></td></tr> </table> <br /> <table class="myprofile_change"> <tr><td class="myprofile_subtext">Location :</td><td><input name="Location" id="Location" type="text" value="<? echo $rows['Location']; ?>" /></td></tr> <tr><td class="myprofile_subtext">Favourite smoking method :</td> <td><select name="Fav" id="Fav"style="width: 126px"> <option>Choose</option> <option>Joint</option> <option>Blunt</option> <option>Tulip</option> <option>Bong</option> <option>Lung</option> <option>Bucket</option></select></td></tr> <tr><td class="myprofile_subtext">Favourite quote :</td><td><input name="Quote" id="Quote"type="text" style="width: 246px" maxlength="50 "value="<? echo $rows['Quote']; ?>" /></td><td class="myprofile_max">Max 50 characters</td></tr> <tr><td></td></tr> </table> <br /> <table> <tr><td class="myprofile_changesh">About me ...</td></tr> </table> <br /> <table> <tr><td class="myprofile_subtext">About Yourself :</td><td rowspan="2"><textarea name="Aboutme" id="Aboutme" style="width: 415px; height: 135px"><? echo $rows['Aboutme']; ?></textarea></td></tr> <tr><td class="myprofile_max2">Use <br /> to separate paragraphs instead of using the return button</td></tr> </table> <br /> <table class="myprofile_change"> <tr><td class="myprofile_subtext">Why do you love weed? :</td> <td rowspan="2"><textarea name="Whywe" id="Whywe" style="width: 415px; height: 135px" ><? echo $rows['Whywe']; ?></textarea></td></tr> <tr><td class="myprofile_max2">Use <br /> to separate paragraphs instead of using the return button</td></tr> <tr><td></td></tr> </table> <br /> <table> <tr><td class="myprofile_changesh">Personal info ...</td></tr> </table> <br /> <table class="myprofile_change"> <tr><td class="myprofile_subtext">Interests :</td><td><input name="Interests" id="Interests" type="text" style="width: 246px" value="<? echo $rows['Interests']; ?>" /></td><td class="myprofile_max">Max 50 characters</td></tr> <tr><td class="myprofile_subtext">Makes me happy :</td><td><input name="Happy" id="Happy"type="text" style="width: 246px" value="<? echo $rows['Happy']; ?>"/></td><td class="myprofile_max">Max 70 characters</td></tr> <tr><td class="myprofile_subtext">Makes me sad :</td><td><input name="Sad" id="Sad"type="text" style="width: 246px" value="<? echo $rows['Sad']; ?>" /></td><td class="myprofile_max">Max 70 characters</td></tr> <tr><td class="myprofile_subtext">Bad habits :</td><td><input name="Habits" id="Habits"type="text" style="width: 246px" value="<? echo $rows['Habits']; ?>" /></td><td class="myprofile_max">Max 60 characters</td></tr> <tr><td></td></tr> </table> <br /> <table> <tr><td class="myprofile_changesh">Favourite things ...</td></tr> </table> <br /> <table class="myprofile_change"> <tr><td class="myprofile_subtext">Music :</td><td><select id="Music"name="Music" style="width: 126px"> <option>Choose</option> <option>Dance</option> <option>RnB</option> <option>Funky House</option> <option>Indie</option> <option>Rock</option> <option>Electro</option> <option>Chillout</option> </select></td></tr> <tr><td class="myprofile_subtext">Movies :</td><td><input name="Movie" id="Movie"type="text" style="width: 246px" value="<? echo $rows['Movie']; ?>" /></td><td class="myprofile_max">Max 100 characters</td></tr> <tr><td class="myprofile_subtext">Website :</td><td><input name="Website" id="Website"type="text" style="width: 246px" value="<? echo $rows['Website']; ?>"/></td><td class="myprofile_max">No spamming</td></tr> <tr><td></td></tr> </table> <? // close while loop } // close connection mysql_close(); ?> <br /> <table> <tr><td class="myprofile_changesh">Save the changes to your profile ...</td></tr> <tr><td></td></tr> <tr><td></td></tr> </table> <br /> <table class="myprofile_change"> <tr><td><input name="Submit1" type="submit" value="Change that shit !" /></td></tr> </table> <br /> <br /> <br /> <br /> <br /> <br /> </form> and then i have the following code for the php but i cant get it to work at all it either deletes all the information for that user or else gives me a blank page please can someone help? i have my session start at the top of the page so it isnt that. editprofilesubmit.php <?php session_start(); if(isset($_SESSION['myusername'])) { } else{ header("location:login.php"); } // Check the user is logged in ?> <?php include("config.php"); $username=$_SESSION['myusername']; $Location = ($_POST['Location']); $Fav = ($_POST['Fav']); $Quote = ($_POST['Quote']); $Interests = ($_POST['Interests']); $Happy = ($_POST['Happy']); $Sad = ($_POST['Sad']); $Habits = ($_POST['Habits']); $Music = ($_POST['Music']); $Movie = ($_POST['Movie']); $Website = ($_POST['Website']); $Aboutme = ($_POST['Aboutme']); $Whywe = ($_POST['Whywe']); $Status = ($_POST['status']); $sql = "UPDATE User_infoT ( Location, Fav, Quote, Interests, Happy, Sad, Habits, Music, Movie, Website, Aboutme, Whywe, Status) VALUES( '$Location', '$Fav', '$Quote', '$Interests', '$Happy', '$Sad', '$Habits' , '$Music', '$Movie', '$Website', '$Aboutme', '$Whywe', '$Status' ) WHERE Username='$username' ; $result=mysql_query($sql) or die(mysql_error().": $sql"); if($result){ header("my_profile.php"); } else { header("profile_edit.php"); } // close connection mysql_close(); ?>
  18. can anyone please help? i can get everything working apart from the if statement for the session as it doesnt redirect when the user is not logged in it just doesnt submit the data to the database!
  19. Its just trying to get my head round what goes where?
  20. Ok im trying to make a suggestions box for my site but i only want users that are logged in to be able to use this! and if they arent then redirect them to the loggin page when ever they try! I have got it working to an extent apart from the redirection bit. Here is the code i ama using! <?php include("config.php"); if(isset($_SESSION['myusername'])) { if(isset($_POST['add_suggestion'])){ $Suggestion_username=$_SESSION['myusername']; $Suggestion_avatar=$_SESSION['myavatar']; $Suggestion_comment=$_POST['Suggestion_comment']; $sql="INSERT INTO Admin_suggestionsT (Suggestion_username, Suggestion_comment, Suggestion_avatar)VALUES('$Suggestion_username', '$Suggestion_comment', '$Suggestion_avatar')"; $result=mysql_query($sql); if($result){ echo "<h1 class=comment_status1>Thanks for your feedback, AdMiN!</h1>"; } else { echo "<h1 class=comment_status2>Ops, try again !</h1>"; } // close connection mysql_close(); } else{ }; } else{ header("location:login.php"); } ?> <form method="post" action="#"> <table> <tr><td></td></tr> <tr><td class="sug_headers"> <input class="sug_user"name="Suggestion_username" visible type="text" style="width: 94px" value="<?php if(isset($_SESSION['myusername']) == True) { echo " ".$_SESSION["myusername"]. " ";} else {echo " Not Registered ";} ?>"></input> </td></tr> <tr><td><textarea class="comments" name="Suggestion_comment">Hear at weloveweed mansion we appreciate your feedback, so feel free to add your comments and dont fucking abuse it <3</textarea></td></tr> <tr><td class="comments" style="height: 34px"> <input class="submit_sug" name="Reset" type="reset" value="D'oh" /><input class="submit_sug" name="add_suggestion" type="submit" value="Whooohoo" /> </td></tr> </table> </form>
  21. Got it using this code! <?php include("config.php"); if(isset($_POST['add_topic'])){ $Post_username=$_SESSION['myusername']; $Post_subject=$_POST['Post_subject']; $Post_message=$_POST['Post_message']; $Post_tags=$_POST['Post_tags']; $Post_pp=$_SESSION['myavatar']; $sql="INSERT INTO User_postT (Post_username, Post_pp, Post_date, Post_subject, Post_message, Post_tags)VALUES('$Post_username', '$Post_pp', NOW(), '$Post_subject', '$Post_message', '$Post_tags')"; $result=mysql_query($sql); if($result){ echo "<h1 class=comment_status1>Your Post has been added successfully</h1>"; } // close connection mysql_close(); } else{ }; ?>
  22. Right at the minute i have all my forms posting to a seperate page instead of the same page but i want them to post ot there self and i only want the php code to run if the submit button has been pressed but im having trouble. This is my form. <br /> <img alt="" src="../Layout_images/forum_add.gif" /><br /> <form method="post" action="add_topic_submit.php"> <table class="addtopic_p" style=align="center" align="center"> <tr><td class="postinfo" valign="top"> Have you got something to tell us? Have you had a <strong>EuReKa </strong>moment? or do u just want to tell us a <strong>"This one time at.....!"</strong> story? Feel free to use this page to post your latest events so that all users of weloveweed can see them. 1000&#39;s of members to be precise! <br /> <br /> <strong>Do not</strong> start to <strong>abuse</strong> this page or <strong>spam</strong> like fuck, <strong>abuse other members</strong> or just <strong>post general bullshit </strong>or i will pull the fucking plug. Respect your home or your <strong>OUT 2 FUCK</strong>. </td></tr> </table> <table class="addtopic_now" align="center"><tr> <td class="addtopic-pad" valign="top"> <table> <tr><td class="post_h1" colspan="3">Title :</td><td class="post_sub">Max 36 characters</td></tr> <tr><td class="title" colspan="4"><input class="post_title" name="Post_subject" maxlength="36" type="text" /></td></tr> <tr><td class="title" colspan="4"></td></tr> <tr><td class="title" colspan="4"></td></tr> <tr><td class="title" colspan="4"></td></tr> <tr><td class="title" colspan="4"></td></tr> <tr><td class="title" colspan="4"></td></tr> <tr><td class="title" colspan="4"></td></tr> <tr><td class="title" colspan="4"></td></tr> <tr><td class="title" colspan="4"></td></tr> <tr><td class="post_h1">Message :</td> <td class="post_sub" colspan="3"> Max 2,000 characters</td></tr> <tr><td class="title" colspan="4"> <textarea class="post_message"name="Post_message" maxlength="2000" cols="48"></textarea></td></tr> <tr><td class="post_h1" colspan="2">Tags :</td><td class="post_sub" colspan="2"> Max 200 characters</td></tr> <tr><td class="title" colspan="4"> <input class="post_tags" name="Post_tags" type="text" maxlength="200" style="width: 395px" /></td></tr> <tr><td class="post_commas" colspan="4">(Make sure and separate your keywords with a comma)</td></tr> </table> </td></tr></table> <table style="width: 440px" align="center"> <tr> <td class="add-80"><img alt="" src="../Forum_images/forum_logo1.jpg" width="40" height="40" /></td> <td class="add-80"><img src="../Forum_images/forum_logo2.jpg" width="40" height="40" /></td> <td class="add-80"><img alt="" src="../Forum_images/forum_logo3.jpg" width="40" height="40" /></td> <td class="add-80"><img alt="" src="../Forum_images/forum_logo4.jpg" width="40" height="40" /></td> <td rowspan="3"><br /></td> <td rowspan="3"><br /></td> <td rowspan="3"><br /> <input name="add_topic" type="image" src="../Header_images/addyourtopic.gif" value="submit" width="160" height="60" onmouseout="FP_swapImgRestore()" onmouseover="FP_swapImg(1,1,/*id*/'img2',/*url*/'../Header_images/addyourtopic_h.gif')" /></td> <td rowspan="3"> </td> </tr> <tr><td> <input name="Radio1" type="radio" checked="checked" value="1" /> </td><td> <input name="Radio2" type="radio" value="2" /> </td><td> <input name="Radio3" type="radio" value="3" /> </td><td> <input name="Radio4" type="radio" value="4" /> </td></tr> <tr> <td class="post_logo" valign="top">Weloveweed</td> <td class="post_logo">Love/Hate</td> <td class="post_logo">Problems</td> <td class="post_logo">Whatever</td></tr> </table> </form> and the php code i am trying to use... <?php include("config.php"); $Post_username=$_SESSION['myusername']; $Post_subject=$_POST['Post_subject']; $Post_message=$_POST['Post_message']; $Post_tags=$_POST['Post_tags']; $Post_pp=$_SESSION['myavatar']; if(isset($_POST['add_topic'])){ $sql="INSERT INTO User_postT (Post_username, Post_pp, Post_date, Post_subject, Post_message, Post_tags)VALUES('$Post_username', '$Post_pp', NOW(), '$Post_subject', '$Post_message', '$Post_tags')"; $result=mysql_query($sql);} else{ }; if($result){ echo "<h1 class=comment_status1>Your Post has been added successfully</h1>"; } // close connection mysql_close(); ?> This is working to an extent as when the page loads it doesnt submit any data but it still echos the your post has been submitted. I only want data and the echo to happen if the submit button has been pressed. please can someone point me in the right direction?
  23. can anyone point me in the right direction!
  24. Unfortunitly Ken i have no choice its one of the modules on my course. Im studying multimedia and internet technology so it has abit of everything. I want to be a designer and possibly abit of php coding, but i dont want to know ajax but i dont have a choice!
×
×
  • 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.