- Impact
- 19
Hey
is this code right to add stuff into a database?
its not working i think
is this code right to add stuff into a database?
its not working i think
PHP:
<form action="<?$_self?>" method="post">
<input type="text" name="author" value="Author">
<textarea name="story">
Story here
</textarea>
<input type="text" name="email" value="AuthorEmail">
<input type="submit" value="Submit"></form>
<?php
$author= $_POST['author'];
$story= $_POST['story'];
$authoremail= $_POST['AuthorEmail'];
$username="fu2_story";
$password="story";
$database="fu2_stories";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = 'INSERT INTO `main` (`author`, `story`, `author_email`) VALUES (\'$author\', \'$story\', \'$authoremail\')';
mysql_query($query);
?>
Last edited:







