I have another situation that I would like to do with my form so I guess I will post my problem here.
I want to create a form where I insert my reviews data into my database
Alright here is the problem, I don't know how I can input data into my database using Checkboxes in my form! I looked at this
tutorial but in this tutorial it is set up for a new table. I don't want that, I already have reviews on my site and I don't want to create new table's on my database.
So the question is: How can I input data using checkboxes without altering my database tables and such?
There are more problems like: Length, and Genre (The checkboxes that I am referring to) Look at the code and you will know what I mean. Any help would be much appreciated!
<?php
//Connect database
?>
<html>
<head>
<title>My first MySQL form submission</title>
</head>
<body>
<?php
if (!isset($_POST['submit'])) {
?>
<form action="" method="post">
Title: <input type="text" name="title"><br>
Japanese Title: <input type="text" name="japtitle"><br>
Summary: <textarea name="summary" cols="50" rows="5"></textarea>
<br>
Genres: <input type="text" name="genres"><br>
Formats: <label><input name="formats" type="checkbox" value="romance" checked>
Romance
</label>
<label><input name="formats" type="checkbox" value="comedy">
Comedy
</label>
<label><input name="formats" type="checkbox" value="horror">
Horror
</label>
<label><input name="formats" type="checkbox" value="ecchi">
Ecchi
</label>
<br>
Number of Episodes: <input name="numberepisodes" type="text" size="3">
<br>
Length:
<label><select name="length" type="select">
<option value=""> -</option>
<option value="30 Minutes / Half hour">30</option>
<option value="1 Minutes">1</option>
</select>
</label>
or
<label>
<input name="length" type="text" size="3">
</label>
<br>
Year Published: <input type="text" name="year"><br>
Opening Theme:
<textarea name="openingtheme"></textarea>
<br>
Ending Theme:
<textarea name="endingtheme"></textarea>
<br>
Official Website: <input type="text" name="website"><br>
<input type="submit" name="submit" value="Submit!">
</form>
</body>
</html>
<?php
} else {
if( mysql_query( "INSERT INTO `anime_reviews` SET `title` = '".mysql_real_escape_string( $_POST['title'] )."', `title_jap` = '".mysql_real_escape_string( $_POST['japtitle'] )."', `summary_synopsis` = '".mysql_real_escape_string( $_POST['summary'] )."', `genres` = '".mysql_real_escape_string( $_POST['genres'] )."', `episode_number` = '".mysql_real_escape_string( $_POST['numberepisodes'] )."', `length` = '".mysql_real_escape_string( $_POST['length'] )."', `year_published` = '".mysql_real_escape_string( $_POST['year'] )."', `opening_theme` = '".mysql_real_escape_string( $_POST['openingtheme'] )."', `ending_theme` = '".mysql_real_escape_string( $_POST['endingtheme'] )."', `official_sites` = '".mysql_real_escape_string( $_POST['website'] )."' ") ) {
echo "Success! Your RomanceAnime.com Review has been added! Congrats";
} else {
echo mysql_error();
}
}
?>