aircooled57 Posted November 27, 2008 Share Posted November 27, 2008 Hello all , i would love some help regarding an issue on my website , basically on the admin backend there are features that allow me to add new tutorials to the database and although none of the backend code behind the site has changed as far as i no , the feature no longer works. web form for adding tutorials : <?php session_start(); { include"../template/admined.php"; ?> <span class="special-font2" style="margin-left:55px">Add New Tutorial</span> <form action="submit_tutorial.php" method="post" enctype="multipart/form-data"> <table border="0" style="margin-left:50px"> <tr><td>Type:</td> <td><select name="type"> <option value="tutorial">Tutorial</option> <option value="xhtml">XHTML </option> <option value="myspace">Myspace</option> <option value="link">Links</option> <option value="member">Member</option> </select> </td></tr> <tr><td>Judul:</td><td> <input type="text" name="judul" size="40"> </td></tr> <tr><td valign="top">Preview:</td><td> <textarea name="elm" style="width:99%" rows="7"> </textarea> </td></tr> <tr><td valign="top">Content:</td><td> <!-- tinyMCE --> <script language="javascript" type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script> <script language="javascript" type="text/javascript"> tinyMCE.init({ theme : "advanced", mode : "exact", elements : "elm1,elm2", save_callback : "customSave", content_css : "example_advanced.css", extended_valid_elements : "a[href|target|name]", plugins : "table", theme_advanced_buttons3_add_before : "tablecontrols,separator", //invalid_elements : "a", theme_advanced_styles : "Header 1=header1;Header 2=header2;Header 3=header3;Table Row=tableRow1", // Theme specific setting CSS classes //execcommand_callback : "myCustomExecCommandHandler", debug : false }); // Custom event handler function myCustomExecCommandHandler(editor_id, elm, command, user_interface, value) { var linkElm, imageElm, inst; switch (command) { case "mceLink": inst = tinyMCE.getInstanceById(editor_id); linkElm = tinyMCE.getParentElement(inst.selection.getFocusElement(), "a"); if (linkElm) alert("Link dialog has been overriden. Found link href: " + tinyMCE.getAttrib(linkElm, "href")); else alert("Link dialog has been overriden."); return true; case "mceImage": inst = tinyMCE.getInstanceById(editor_id); imageElm = tinyMCE.getParentElement(inst.selection.getFocusElement(), "img"); if (imageElm) alert("Image dialog has been overriden. Found image src: " + tinyMCE.getAttrib(imageElm, "src")); else alert("Image dialog has been overriden."); return true; } return false; // Pass to next handler in chain } // Custom save callback, gets called when the contents is to be submitted function customSave(id, content) { } </script> <!-- /tinyMCE --> <textarea name="elm1" style="width:100%" rows="30" cols="40"> </textarea> </td></tr> <tr><td>Icon</td><td> <input type="file" name="icon"> </td></tr> <tr><td>Picture</td><td> <input type="file" name="pict"> </td></tr> <tr><td>Upload File</td><td> <input type="file" name="upload"> </td></tr> <tr><td ></td><td> <input type="submit" name="submit" value="Add">   <input type="button" onclick=";self.location.href='admin_tutorial.php'" value="Cancel" /> </td></tr> </table> </form> <? } ?> </div> <div class="clear"></div> <div id="footer"> <span style="float:right; margin:5px 25px 0 0; color:#5a5a5a">© Copyright 2008 <strong><a href="#">Purple Fusion</a></strong> - All Rights Reserved</span> <span style="float:left; margin:5px 0 0 45px; color:#5a5a5a"><a href="http://validator.w3.org/check?uri=referer">HTML Validation</a> | <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS Validation</a></span> </div> </body> </html> This is the script that sends information in webform to a database , this file is called submit_tutorial.php <? session_start(); include"../template/admined.php"; include"../config.php"; if($submit) { if(!empty($judul) && !empty($pict) && !empty($icon) && !empty($upload) && !empty($elm) && !empty($elm1)) { $location = "./images/".$HTTP_POST_FILES['pict']['name']; $location1 = "./images/".$HTTP_POST_FILES['icon']['name']; $location2 = "./file/".$HTTP_POST_FILES['upload']['name']; move_uploaded_file($pict, $location); move_uploaded_file($icon, $location1); move_uploaded_file($upload, $location2); mysql_query("INSERT INTO tutorial(id,title,preview,details,picture,icon,type,file) values('','$judul','$elm','$elm1','$location','$location1','$type','$location2')") or die(mysql_error()); echo "<center>Succesfully Added <a href='admin_tutorial.php'>Back</a>"; }else{ echo"<script>alert('Should not empty');history.go(-1)</script>"; } }else{ echo"<script>alert('Failed to edit');history.go(-1)</script>"; } ?> </div> <div class="clear"></div> <div id="footer"> <span style="float:right; margin:5px 25px 0 0; color:#5a5a5a">© Copyright 2008 <strong><a href="#">Purple Fusion</a></strong> - All Rights Reserved</span> <span style="float:left; margin:5px 0 0 45px; color:#5a5a5a"><a href="http://validator.w3.org/check?uri=referer">HTML Validation</a> | <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS Validation</a></span> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/134529-php-help-inserting-into-database/ Share on other sites More sharing options...
Mchl Posted November 27, 2008 Share Posted November 27, 2008 First question: do you have short tags enabled on your server? Maybe they got disabled recently... Either way all your php scripts should start with <?php and not <? (<? are deprecated and will be removed in PHP6) Quote Link to comment https://forums.phpfreaks.com/topic/134529-php-help-inserting-into-database/#findComment-700464 Share on other sites More sharing options...
aircooled57 Posted November 27, 2008 Author Share Posted November 27, 2008 i have manually changed all the <php tags to ur specified format however i still get the problem im having before that when i try and sumbit the tutorial it echos the error message Quote Link to comment https://forums.phpfreaks.com/topic/134529-php-help-inserting-into-database/#findComment-700492 Share on other sites More sharing options...
Mchl Posted November 27, 2008 Share Posted November 27, 2008 What is the error message? Quote Link to comment https://forums.phpfreaks.com/topic/134529-php-help-inserting-into-database/#findComment-700495 Share on other sites More sharing options...
aircooled57 Posted November 27, 2008 Author Share Posted November 27, 2008 if u sift thru the code for submit_tutorial.php you will see were the echo is triggered . Quote Link to comment https://forums.phpfreaks.com/topic/134529-php-help-inserting-into-database/#findComment-700497 Share on other sites More sharing options...
aircooled57 Posted November 27, 2008 Author Share Posted November 27, 2008 it is supposed to print that error when it cant sumbit the tutorial into the database , but i see no reason for it not to go in. Quote Link to comment https://forums.phpfreaks.com/topic/134529-php-help-inserting-into-database/#findComment-700499 Share on other sites More sharing options...
Mchl Posted November 27, 2008 Share Posted November 27, 2008 Sorry, but I don't. Unless you mean or die(mysql_error()) But I still don;t know what is the exact error message. Quote Link to comment https://forums.phpfreaks.com/topic/134529-php-help-inserting-into-database/#findComment-700508 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.