Tuesday, 17 September 2013

Using jquery on a .php file

Using jquery on a .php file

How do I add jquery to this page as the HTML head element of the page is
in the include() file. Do I have to add it to the HTML form found at the
bottom of the page? Or do I add the Jquery to the ./includes/header.html
page ?
Add A film"; if(isset($_POST['submitted'])){ $errors = array(); //
Initialize erroy array. // Check for title. if
(empty($_POST['movie_title'])){ $errors[] = "You forgot to enter a
title."; } else { $mn = (trim($_POST['movie_title'])); } // Check for
leading actor if (empty($_POST['leading_actor'])){ $errors[] = "You forgot
to enter the leading actor."; } else { $la =
(trim($_POST['leading_actor'])); } // Check for a rating if
(empty($_POST['rating'])){ $errors[] = "Please select a rating."; } else {
$rating = ($_POST['rating']); } // Check for a review if
(empty($_POST['review'])){ $errors[] = "Please write a review"; } else {
$review = (trim($_POST['review'])); } if (empty($errors)) { // If no
errors were found. require_once('./includes/Mysql_connect.php'); // Make
the insert query. $query = "INSERT INTO films (movie_title, actor, rating)
Values ('$mn', '$la', '$rating' )"; $result = mysql_query($query); $id =
mysql_insert_id(); $query = "INSERT INTO reviewed (review, movie_id)
values ('$review', '$id')"; $result = mysql_query($query); //Report
errors. } else { foreach ($errors as $msg){ echo " - $msg
"; } } } ?>
<form action="add_film.php" method="post" id="add_film">
<label for="title">Movie Title</label>
<input type="text" name="movie_title" id="movie_title" />
<br/>
<br/>
<label for="actor">Leading Actor</label>
<input type="text" name="leading_actor" id="leading_name" />
<br/>
<br/>
<label for="rating">Rating</label>
<select id="rating[]" name="rating" />
<option selected="selected" disabled="disabled">Select a
Rating</option>
<option value="Terrible">Terrible</option>
<option value="Fair">Fair</option>
<option value="Ok">Ok</option>
<option value="Good">Good</option>
<option value="Excellent">Excellent</option>
</select>
<br/>
<br/>
<label for="review">Your Review</label>
<br/>
<textarea name="review" id="textarea" rows="15" cols="60"></textarea>
<br/>
<br/>
<input type="submit" name="submit" id="submit" value="submit" />
<input type="hidden" name="submitted" value="TRUE" />

No comments:

Post a Comment