Kaboom Posted October 18, 2009 Share Posted October 18, 2009 So my blog is ALMOST done now Here is the problem. I keep getting incomplete data fields error. Here is my post.php: <?php include "../config.php"; include "../func.php"; include "../english.php"; $config=config(); if (!$config[3][1]) msg("Posting closed"); else { $_POST["subject"]=clean($_POST["subject"]); $_POST["name"]=clean($_POST["name"]); $_POST["inhoud"]=clean($_POST["inhoud"]); if (!is_user2($_POST["name"])) if (($_POST["name"]!="")&&($_POST["subject"]!="")&&($_POST["inhoud"]!="")) if ($_SESSION["code"]==$_POST["code"]) baby($_POST["name"], ($_POST["subject"]), $_POST["inhoud"]); else msg($lang['incorCode']); else msg($lang['dataFields']); } ?> now english and config arent important but heres the functions I use in func.php to post: function baby($name, $subject, $inhoud) { global $db_id; $query="insert into `baby` (`poster`, `subject`, `content`, `date`) values('".$name."', '".$subject."', '".$inhoud."', now())"; $result=mysql_query($query, $db_id); if ($result) msg("The message was posted successfully."); else msg("Failed.".mysql_error()); } function is_user2($name) { global $db_id; $query="select count(*) from users where name='".$name."'"; $result=mysql_query($query, $db_id); $row=mysql_fetch_row($result); return $row[0]; } How do I make it actually post now ... it has everything just something is wrong soit won't post it help? Link to comment https://forums.phpfreaks.com/topic/178082-really-quick-help/ Share on other sites More sharing options...
Garethp Posted October 18, 2009 Share Posted October 18, 2009 What error message are you getting? Link to comment https://forums.phpfreaks.com/topic/178082-really-quick-help/#findComment-938970 Share on other sites More sharing options...
Kaboom Posted October 18, 2009 Author Share Posted October 18, 2009 What error message are you getting? I get Data fields have not been completed correctly. It comes from this: else msg($lang['dataFields']); But idk what fields are missing ... here is the code thats its posting from if it helps <form name="form1" method="post" action="post.php"> <p>Subject: <input class='textbox' name="subject" type="text" size="45" value=""> </p> <p> <textarea class='textbox' name="inhoud" cols="60" rows="20"><?php if (isset($_GET["content"])) {$msg=content(clean($_GET["content"])); echo "\r\n\r\n[".$msg[5]."]\r\n".$msg[4];} ?></textarea> </p> <p> <label><?php echo $lang['typeCode'] ?> '<?php echo $_SESSION["code"];?>' <input class='textbox' type="text" name="code"></label></p> <p><input class='button' type="submit" name="baby" value="Post"> </p> </form> Link to comment https://forums.phpfreaks.com/topic/178082-really-quick-help/#findComment-938981 Share on other sites More sharing options...
Garethp Posted October 18, 2009 Share Posted October 18, 2009 Change else msg($lang['dataFields']); to else { print_r($_POST); exit(); } That'll show you what your POSTing, and why it's going wrong Link to comment https://forums.phpfreaks.com/topic/178082-really-quick-help/#findComment-938984 Share on other sites More sharing options...
Kaboom Posted October 18, 2009 Author Share Posted October 18, 2009 Change else msg($lang['dataFields']); to else { print_r($_POST); exit(); } That'll show you what your POSTing, and why it's going wrong Thanks ill let you know EDIT: it says: Array ( [subject] => fgdfgfd [inhoud] => => 3492 [baby] => Post [name] => ) Link to comment https://forums.phpfreaks.com/topic/178082-really-quick-help/#findComment-938985 Share on other sites More sharing options...
Garethp Posted October 18, 2009 Share Posted October 18, 2009 Oh, and don't just copy from the page, copy from the source (Ctrl+U when the page is open) Link to comment https://forums.phpfreaks.com/topic/178082-really-quick-help/#findComment-938986 Share on other sites More sharing options...
Kaboom Posted October 18, 2009 Author Share Posted October 18, 2009 Okay heres newpost.php <?php include "../config.php"; include "../func.php"; include "../english.php"; include("../bb.php"); $_SESSION["code"]=rand(1000, 9999); if (!isset($_SESSION["user"][0])) {header('Location: http://www.stephanddarryn.com/blog/login.php'); die();} ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Darryn N Steph's Blog • Babys</title> <link rel="shortcut icon" href="http://www.stephanddarryn.com/2009-files/favicon.ico" type="image/x-icon"> <style type="text/css"> @import url("http://www.stephanddarryn.com/2009-files/style.css"); </style> </head> <body> <div id="contain"> <div class="top""> <div id="head2"> <h1>Darryn N Steph's Blog</h1> <?php menu_up(); ?> </div> <div id="search"> <form method="get" action="http://www.stephanddarryn.com/search.php"> <input autocomplete="off" type="text" name="q" title="search" class="search" value="Search Site..." /> <input type="submit" name="Search" class="submit" value="Search" tabindex="3" /> <input type="hidden" name="goto_uri" value="/"> </form> </div> </div> <div id="right"> <div class="postposition"><div class="postarea"> <center> <form name="form1" method="post" action="post.php"> <p>Subject: <input class='textbox' name="subject" type="text" size="45" value=""> </p> <p <a href="javascript://" onClick="document.form1.inhoud.value += ':grin:'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_biggrin.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':S'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_confused.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ''"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_cool.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':.('"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_cry.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':eek:'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_eek.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':evil:'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_evil.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ''"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_lol.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':@'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_mad.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ''"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_mrgreen.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':|'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_neutral.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ''"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_razz.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':$'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_redface.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':roll:'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_rolleyes.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ''"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_sad.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ''"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_smile.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ''"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_surprised.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':twisted:'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_twisted.gif border=0></a><br /> <a href="javascript://" onClick="document.form1.inhoud.value += ''"><img srchttp://www.stephanddarryn.com/blog/2009/=images/smiles/icon_wink.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':{'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_dracula.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':sick:'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_sick.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':uhm:'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_uhm.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':clap:'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_clap.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':dance:'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_dance.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ''"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_stop.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':doh:'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_doh.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':nono:'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_nono.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':think:'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_think.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':ssht:'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_ssht.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':nope:'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_nope.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':salut:'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_salut.gif border=0></a> <a href="javascript://" onClick="document.form1.inhoud.value += ':wall:'"><img src=http://www.stephanddarryn.com/blog/2009/images/smiles/icon_wall.gif border=0></a></p> <p> <textarea class='textbox' name="inhoud" cols="60" rows="20"><?php if (isset($_GET["content"])) {$msg=content(clean($_GET["content"])); echo "\r\n\r\n[".$msg[5]."]\r\n".$msg[4];} ?></textarea> </p> <p> <label><?php echo $lang['typeCode'] ?> '<?php echo $_SESSION["code"];?>' <input class='textbox' type="text" name="code"></label></p> <p><input class='button' type="submit" name="baby" value="Post"> </p> </form> </center> </div></div> <div class="copy">Copyright ©2009 StephAndDarryn.com, All rights reserved<br /> <a href="http://www.mozilla.com/en-US/firefox/firefox.html"><img src="http://www.stephanddarryn.com/2009-files/firefox.png" border="0" title="Get Firefox to view this site correctly" /></a><a href="http://www.stopie.com/"><img src="http://www.stephanddarryn.com/2009-files/stopie.gif" border="0" title="Stop using Internet Explorer, heres why!" /></a><a href="http://sitefrost.com/member.php?action=register&referrername=KaBooM"><img src="http://www.animebb.co.cc/images/site-frost.png" border="0" title="Free post to host hosting here!" /></a></div> </div> </div> </body> </html> and heres post.php: <?php include "../config.php"; include "../func.php"; include "../english.php"; $config=config(); if (!$config[3][1]) msg("Posting closed"); else { $_POST["subject"]=clean($_POST["subject"]); $_POST["name"]=clean($_POST["name"]); $_POST["inhoud"]=clean($_POST["inhoud"]); if (!is_user2($_POST["name"])) if (($_POST["name"]!="")&&($_POST["subject"]!="")&&($_POST["inhoud"]!="")) if ($_SESSION["code"]==$_POST["code"]) baby($_POST["name"], ($_POST["subject"]), $_POST["inhoud"]); else msg($lang['incorCode']); { print_r($_POST); exit(); } } ?> and heres func.php: <?php function baby($name, $subject, $inhoud) { global $db_id; $query="insert into `baby` (`poster`, `subject`, `content`, `date`) values('".$name."', '".$subject."', '".$inhoud."', now())"; $result=mysql_query($query, $db_id); if ($result) msg("The message was posted successfully."); else msg("Failed.".mysql_error()); } function is_user2($name) { global $db_id; $query="select count(*) from users where name='".$name."'"; $result=mysql_query($query, $db_id); $row=mysql_fetch_row($result); return $row[0]; } ?> SO ... why isn't it posting. Using your idea to find the problem it says Array ( [subject] => fgdfgfd [inhoud] => [code] => 3492 [baby] => Post [name] => ) Link to comment https://forums.phpfreaks.com/topic/178082-really-quick-help/#findComment-938989 Share on other sites More sharing options...
Kaboom Posted October 18, 2009 Author Share Posted October 18, 2009 Omg i think I see... it's not showing name, so name isn't posting '.name.' right? Link to comment https://forums.phpfreaks.com/topic/178082-really-quick-help/#findComment-938991 Share on other sites More sharing options...
Garethp Posted October 18, 2009 Share Posted October 18, 2009 Yeah, that's probably it Link to comment https://forums.phpfreaks.com/topic/178082-really-quick-help/#findComment-938994 Share on other sites More sharing options...
Kaboom Posted October 18, 2009 Author Share Posted October 18, 2009 So ... how would I make this post those fields into the table baby? I gave all ym code, can you tell me what to change to make it work? Link to comment https://forums.phpfreaks.com/topic/178082-really-quick-help/#findComment-938996 Share on other sites More sharing options...
Garethp Posted October 18, 2009 Share Posted October 18, 2009 If you tip me yeah, otherwise I'm a bit too busy. But here's a main hint. Code is ALOT easier to read if you use if (Statement) { //code } else { //code } instead of if(statement) //code else //code Link to comment https://forums.phpfreaks.com/topic/178082-really-quick-help/#findComment-938998 Share on other sites More sharing options...
Kaboom Posted October 18, 2009 Author Share Posted October 18, 2009 If you tip me yeah, otherwise I'm a bit too busy. But here's a main hint. Code is ALOT easier to read if you use if (Statement) { //code } else { //code } instead of if(statement) //code else //code Okay ... I cleaned it up a bit in the files but now anyone else at all tell me why it isnt working? Link to comment https://forums.phpfreaks.com/topic/178082-really-quick-help/#findComment-939003 Share on other sites More sharing options...
Kaboom Posted October 18, 2009 Author Share Posted October 18, 2009 Okay so now heres the post.php: <?php include "../config.php"; include "../func.php"; include "../english.php"; $config=config(); if (!$config[3][1]) { msg("Posting closed"); } else { $_POST["subject"]=clean($_POST["subject"]); $_POST["name"]=clean($_POST["name"]); $_POST["inhoud"]=clean($_POST["inhoud"]); if (!is_user2($_POST["name"])) if (($_POST["name"]!="")&&($_POST["subject"]!="")&&($_POST["inhoud"]!="")) if ($_SESSION["code"]==$_POST["code"]) {baby($_POST["name"], ($_POST["subject"]), $_POST["inhoud"]);} else msg($lang['incorCode']); else print_r($_POST); } ?> Now .... Why is it saying Array ( [subject] => g [inhoud] => :dance: [code] => 1594 [baby] => Post [name] => ) [baby] => Post [name] => Should even be there because its supposed to post into the DB baby not post baby ... how???? How do I make it save the posts :'( Link to comment https://forums.phpfreaks.com/topic/178082-really-quick-help/#findComment-939015 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.