ccrevcypsys Posted December 31, 2007 Share Posted December 31, 2007 Ok so i dont know why this statement isnt working.. <?php if(!empty($_POST['name'])){ $insert = mysql_query("INSERT INTO `servicerequested` (serviceName, description) VALUES ( '".$_POST['name']."', '".$_POST['desc']."' )")or die(mysql_error()); } ?> <form action="" method="post" enctype="text/plain"> <table> <tr> <td>Service Name:</td><td><input name="name" value="" type="text" /></td> </tr> <tr> <td>Description:</td><td><textarea name="desc" ></textarea></td> </tr> <tr> <td colspan="2"><input type="submit" name="submit" value="Add" /></td> </tr> </table> </form> Quote Link to comment https://forums.phpfreaks.com/topic/83867-solved-wtf-easy-but-wtf/ Share on other sites More sharing options...
ccrevcypsys Posted December 31, 2007 Author Share Posted December 31, 2007 when ever i hit the add button it just basically refreashes the page and doesnt add ne thing into the db. Quote Link to comment https://forums.phpfreaks.com/topic/83867-solved-wtf-easy-but-wtf/#findComment-426812 Share on other sites More sharing options...
Barand Posted December 31, 2007 Share Posted December 31, 2007 with enctype="text/plain" nothing gets posted. Quote Link to comment https://forums.phpfreaks.com/topic/83867-solved-wtf-easy-but-wtf/#findComment-426814 Share on other sites More sharing options...
ccrevcypsys Posted December 31, 2007 Author Share Posted December 31, 2007 I even changed it to multipart/form-data Quote Link to comment https://forums.phpfreaks.com/topic/83867-solved-wtf-easy-but-wtf/#findComment-426815 Share on other sites More sharing options...
Barand Posted December 31, 2007 Share Posted December 31, 2007 I removed the enctype completely and the query attempted to execute. Â With the text/plain it told me $_POST['name'] was undefined when I submitted the data Quote Link to comment https://forums.phpfreaks.com/topic/83867-solved-wtf-easy-but-wtf/#findComment-426817 Share on other sites More sharing options...
CMC Posted December 31, 2007 Share Posted December 31, 2007 Try changing the form action <form action="" method="post"> to the name of the script. Quote Link to comment https://forums.phpfreaks.com/topic/83867-solved-wtf-easy-but-wtf/#findComment-426818 Share on other sites More sharing options...
revraz Posted December 31, 2007 Share Posted December 31, 2007 enctype = content-type [CI] This attribute specifies the content type used to submit the form to the server (when the value of method is "post"). The default value for this attribute is "application/x-www-form-urlencoded". The value "multipart/form-data" should be used in combination with the INPUT element, type="file". Quote Link to comment https://forums.phpfreaks.com/topic/83867-solved-wtf-easy-but-wtf/#findComment-426819 Share on other sites More sharing options...
Barand Posted December 31, 2007 Share Posted December 31, 2007 default action is "itself" Quote Link to comment https://forums.phpfreaks.com/topic/83867-solved-wtf-easy-but-wtf/#findComment-426820 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.