tracy Posted November 13, 2006 Share Posted November 13, 2006 I have tried several different methods for inserting data into mysql using php (through an html form).Unsuccessful...I can insert the data if I write the data to be inserted into the php code, so I know the mysql connection and php are working.When I try to have an html form write to insert.php, for example...no go.Also, when I try to use the self write method...no go.My server support said that everything is fine there and mentioned something about chmoded...Any suggestions would be appreciated. Link to comment https://forums.phpfreaks.com/topic/27115-html-forms-php-and-mysql/ Share on other sites More sharing options...
printf Posted November 13, 2006 Share Posted November 13, 2006 Could you please show your HTML form and the insert.php script?printf Link to comment https://forums.phpfreaks.com/topic/27115-html-forms-php-and-mysql/#findComment-123953 Share on other sites More sharing options...
tracy Posted November 13, 2006 Author Share Posted November 13, 2006 This is the insert.php file. The html form is simple and writes to this insert.php file, supposedly. It has two areas to fill in, one that is a make (as in auto make) and one that is model (as in auto model). That's all...<html><body><?phpmysql_connect("localhost","small_user","password");if (!con) { die('could not connect: '.mysql_error()); }mysql_select_db ('small_whatever');$sql="INSERT INTO data (Make,Model) VALUES('$_POST[make]','$_POST[model]')";echo "one record added";?></body></html>This is the html form:<html><title>Test Self Form</title><body><form action="insert.php" method="post">Make: <input type="text" name="make" />Model: <input type="text" name="model" /><input type="submit" /></form></body></html> Link to comment https://forums.phpfreaks.com/topic/27115-html-forms-php-and-mysql/#findComment-123961 Share on other sites More sharing options...
tracy Posted November 13, 2006 Author Share Posted November 13, 2006 One more note:I think it is an issue with the server...permissions or something.I have written other php codes that write to the mysql and they work fine. I am mainly interested in knowing more about permissions for file writing on the server, but any help is appreciated. Thanks. Link to comment https://forums.phpfreaks.com/topic/27115-html-forms-php-and-mysql/#findComment-123962 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.