Hello all, First I would like to say thank you to anyone helping, it is very much appreciated.
I’m trying to create a database of all of my movies(I know there are programs that do this but I would like to make my own)
So far I have created a database with xammp and a form to insert information into that database (I think it’s working right)
I would like for the submit button of my form to create a new page that lists all of the form information, I would like to have a template for this page and place holders for where all the information will go, however I don’t know how I should go about doing this.
Here is everything I have so far
My database http://i.imgur.com/fKcpaet.jpg
index.html
<html>
<head><title>Add Movie or Tv show</title></head>
<body>
<form enctype="multipart/form-data" id="myForm" action="addedinfo.php" method="post">
<table width="1233" height="593" border="0">
<tr bgcolor="#FFFFFF">
<th height="160" colspan="3" scope="col"><h1><strong>Add Movie or TV Show to Database</strong></h1></th>
</tr>
<tr>
<td width="317" height="425"><p> Movie Name:</p>
<p>
<input type="text" name="Movie_Name" />
<br />
</p>
<p>
<label> Poster<br>
</label>
<input type="FILE" name="Poster">
<br>
</p>
<p>Genre:</p>
<p>
<select multiple name="Genre[]" id="Genre">
<option value="All" style="text-indent: 0px;" selected="selected">All</option>
<option value="Action" style="text-indent: 0px;">Action</option>
<option value="Adventure" style="text-indent: 0px;">Adventure</option>
<option value="Animation" style="text-indent: 0px;">Animation</option>
<option value="Biography" style="text-indent: 0px;">Biography</option>
<option value="Comedy" style="text-indent: 0px;">Comedy</option>
<option value="Crime" style="text-indent: 0px;">Crime</option>
<option value="Documentary" style="text-indent: 0px;">Documentary</option>
<option value="Drama" style="text-indent: 0px;">Drama</option>
<option value="Family" style="text-indent: 0px;">Family</option>
<option value="Fantasy" style="text-indent: 0px;">Fantasy</option>
<option value="Film-Noir" style="text-indent: 0px;">Film-Noir</option>
<option value="History" style="text-indent: 0px;">History</option>
<option value="Horror" style="text-indent: 0px;">Horror</option>
<option value="Mystery" style="text-indent: 0px;">Mystery</option>
<option value="Romance" style="text-indent: 0px;">Romance</option>
<option value="Sci-Fi" style="text-indent: 0px;">Sci-Fi</option>
<option value="Short" style="text-indent: 0px;">Short</option>
<option value="Sport" style="text-indent: 0px;">Sport</option>
<option value="Thriller" style="text-indent: 0px;">Thriller</option>
<option value="War" style="text-indent: 0px;">War</option>
<option value="Western" style="text-indent: 0px;">Western</option>
</select>
</p>
<p>
<label>IMDB Rating:</label>
</p>
<p>
<select name="IMDB_Rating" id="IMDB_Rating">
<option value="0" style="text-indent: 0px;" selected="selected">All</option>
<option value="9.9" style="text-indent: 0px;">10</option>
<option value="9" style="text-indent: 0px;">9+</option>
<option value="8" style="text-indent: 0px;">8+</option>
<option value="7" style="text-indent: 0px;">7+</option>
<option value="6" style="text-indent: 0px;">6+</option>
<option value="5" style="text-indent: 0px;">5+</option>
<option value="4" style="text-indent: 0px;">4+</option>
<option value="3" style="text-indent: 0px;">3+</option>
<option value="2" style="text-indent: 0px;">2+</option>
<option value="1" style="text-indent: 0px;">1+</option>
</select>
</p></td>
<td width="900"><p> </p>
<p>Quality:
<label class="label">Quality:<br>
</label>
<select name="Quality" id="Quality">
<option value="All" style="text-indent: 0px;" selected="selected">All</option>
<option value="1080p" style="text-indent: 0px;">1080p</option>
<option value="3D" style="text-indent: 0px;">3D</option>
<option value="480p" style="text-indent: 0px;">480p</option>
<option value="720p" style="text-indent: 0px;">720p</option>
<option value="DVD" style="text-indent: 0px;">DVD</option>
<option value="HDRip" style="text-indent: 0px;">HDRip</option>
</select>
</p>
<p> Year:</p>
<p>
<input type="text" name="Year" />
<br />
</p>
<p>Trailer: </p>
<p>
<input type="text" name="Trailer" />
<br />
</p>
<p>Synopsis:</p>
<p>
<textarea cols="50" rows="4" name="Synopsis"></textarea>
</p></td>
<td width="900"><img src="Reel.jpg" alt="" width="447" height="407" align="top"/></td>
</tr>
</table>
<h1 align="left"><button id="sub">Submit</button>
</h1>
</form>
<span id="result"></span/
</body>
</html>
db.php (connection to database)
<?php
$conn = mysql_connect("localhost", "root", "spencer");
$db = mysql_select_db('movies');
?>
and addedinfo.php It has an error currently. Notice: Array to string conversion in C:\xampp\htdocs\movies\addedinfo.php on line 18
Failed
Line 18 = if (mysql_query (“INSERT INTO movieinfo VALUES (’’,’$Movie_Name’,’$Poster’, ‘$genres’, ‘$IMDB_Rating’, ‘$Quality’, ‘$Year’, ‘$Trailer’,’$Synopsis’)”))
I’m not sure if it’s the image (poster) Genres(array) or Synopsis causing the error.
[php]
<?php include_once('db.php'); if($_SERVER['REQUEST_METHOD'] == 'POST'){ $Movie_Name = $_POST['Movie_Name']; $Poster = $_FILES['Poster']; if(isset($GenreArray)) { $genres = serialize($GenreArray); } else { $genres = ''; // this is in case user selects nothing (to be on the safe side) } $IMDB_Rating = $_POST['IMDB_Rating']; $Quality = $_POST['Quality']; $Year = $_POST['Year']; $Trailer = $_POST['Trailer']; $Synopsis = $_POST['Synopsis']; } if (mysql_query ("INSERT INTO movieinfo VALUES ('','$Movie_Name','$Poster', '$genres', '$IMDB_Rating', '$Quality', '$Year', '$Trailer','$Synopsis')")) echo "Successfull"; else echo "Failed" ?>[/php]
I’m not worried about any security as this site will only be running on localhost, as it’s just for me.
Thank you again for your time, and knowledge.