i have this table in a database :
CREATE TABLE FILM(
F_ID INT(5) NOT NULL ,
F_TITLE VARCHAR(40) DEFAULT 'unknown' NOT NULL,
DIRECTOR_FNAME VARCHAR(20) DEFAULT 'unknown' NOT NULL,
DIRECTOR_LNAME VARCHAR(20) DEFAULT 'unknown' NOT NULL,
TYPE VARCHAR(30) DEFAULT 'unknown' NOT NULL,
DURATION TIME ,
YEAR_RELEASE YEAR NOT NULL,
DESCRIPTION TEXT,
DVD_COPIES SMALLINT(2),
VHS_COPIES SMALLINT(2),
RENT_TIME SMALLINT(2),
PRICE VARCHAR(4) NOT NULL CHECK(PRICE>0),
F_EMPLOYEE_CARD_ID CHAR(9),
DVD BOOLEAN,
VHS BOOLEAN,
PRIMARY KEY(F_TITLE),
UNIQUE(F_ID));
and i have done this form for registrating new films
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns
="urn:schemas-microsoft-com
ffice
ffice" xmlns="[
www.w3.org];
<center>
<head>
<title>ΕΓΓΡΑΦΗ ΝΕΑΣ ΤΑΙΝΙΑΣ</title>
</head>
<body bgcolor="#6699FF">
<td align=center>
<h3> <td align=center> ΕΓΓΡΑΦΗ ΝΕΑΣ ΤΑΙΝΙΑΣ <tr></h3>
<form name=reg_film action="reg_film.php" method="POST">
<table border=0>
<tr>
<td align = left>
ΚΩΔΙΚΟΣ:
</td>
<td align=left>
<input type=text size=5 name=F_ID MAXLENGTH=5 AUTOCOMPLETE=ON>
</td>
</tr>
<tr>
<td align = left>
ΤΙΤΛΟΣ:
</td>
<td align=left>
<input type=text size=40 name=F_TITLE MAXLENGTH=40 AUTOCOMPLETE=ON>
<td align=left>
</tr>
<tr>
<td align = left>
ΟΝΟΜΑ <BR>ΣΚΗΝΟΘΕΤΗ:
</td>
<td align=left>
<input type=text size=20 name=DIRECTOR_FNAME MAXLENGTH=20 AUTOCOMPLETE=ON>
</td>
</tr>
<tr>
<td align = left>
ΕΠΩΝΥΜΟ <BR>ΣΚΗΝΟΘΕΤΗ:
</td>
<td align=left>
<input type=text size=20 name=DIRECTOR_LNAME MAXLENGTH=20 AUTOCOMPLETE=ON>
</td>
</tr>
<tr>
<td align = left>
ΚΑΤΗΓΟΡΙΑ:
</td>
<td align=left>
<input type=text size=30 name=TYPE MAXLENGTH=30 AUTOCOMPLETE=ON>
</td>
</tr>
<tr>
<td align = left>
ΔΙΑΡΚΕΙΑ:
</td>
<td align=left>
<select name=DURATION_HOUR size="1" >
<option selected value="hour">hour</option>
<option value="00">00</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">059</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
</select>
: <select name=DURATION_MIN size="1">
<option selected value="minutes">minutes</option>
<option value="00">00</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
<option value="32">32</option>
<option value="33">33</option>
<option value="34">34</option>
<option value="35">35</option>
<option value="36">36</option>
<option value="37">37</option>
<option value="38">38</option>
<option value="39">39</option>
<option value="40">40</option>
<option value="41">41</option>
<option value="42">42</option>
<option value="43">43</option>
<option value="44">44</option>
<option value="45">45</option>
<option value="46">46</option>
<option value="47">47</option>
<option value="48">48</option>
<option value="49">49</option>
<option value="50">50</option>
<option value="51">51</option>
<option value="52">52</option>
<option value="53">53</option>
<option value="54">54</option>
<option value="55">55</option>
<option value="56">56</option>
<option value="57">57</option>
<option value="58">58</option>
<option value="59">59</option>
</select>
: <select name=DURATION_SEC size="1">
<option selected value="seconds">seconds</option>
<option value="00">00</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
<option value="32">32</option>
<option value="33">33</option>
<option value="34">34</option>
<option value="35">35</option>
<option value="36">36</option>
<option value="37">37</option>
<option value="38">38</option>
<option value="39">39</option>
<option value="40">40</option>
<option value="41">41</option>
<option value="42">42</option>
<option value="43">43</option>
<option value="44">44</option>
<option value="45">45</option>
<option value="46">46</option>
<option value="47">47</option>
<option value="48">48</option>
<option value="49">49</option>
<option value="50">50</option>
<option value="51">51</option>
<option value="52">52</option>
<option value="53">53</option>
<option value="54">54</option>
<option value="55">55</option>
<option value="56">56</option>
<option value="57">57</option>
<option value="58">58</option>
<option value="59">59</option>
</select>
</td>
</tr>
<tr>
<td align = left>
ΕΤΟΣ <BR>ΠΑΡΑΓΩΓΗΣ:
</td>
<td align=left>
<select name=YEAR_RELEASE size="1" >
<option selected value="year">year</option>
<option value="1950">1950</option>
<option value="1951">1951</option>
<option value="1952">1952</option>
<option value="1953">1953</option>
<option value="1954">1954</option>
<option value="1955">1955</option>
<option value="1956">1956</option>
<option value="1957">1957</option>
<option value="1958">1958</option>
<option value="1959">1959</option>
<option value="1960">1960</option>
<option value="1961">1961</option>
<option value="1962">1962</option>
<option value="1963">1963</option>
<option value="1964">1964</option>
<option value="1965">1965</option>
<option value="1966">1966</option>
<option value="1967">1967</option>
<option value="1968">1968</option>
<option value="1969">1969</option>
<option value="1970">1970</option>
<option value="1971">1971</option>
<option value="1972">1972</option>
<option value="1973">1973</option>
<option value="1974">1974</option>
<option value="1975">1975</option>
<option value="1976">1976</option>
<option value="1977">1977</option>
<option value="1978">1978</option>
<option value="1979">1979</option>
<option value="1980">1980</option>
<option value="1981">1981</option>
<option value="1982">1982</option>
<option value="1983">1983</option>
<option value="1984">1984</option>
<option value="1985">1985</option>
<option value="1986">1986</option>
<option value="1987">1987</option>
<option value="1988">1988</option>
<option value="1989">1989</option>
<option value="1990">1990</option>
<option value="1991">1991</option>
<option value="1992">1992</option>
<option value="1993">1993</option>
<option value="1994">1994</option>
<option value="1995">1995</option>
<option value="1996">1996</option>
<option value="1997">1997</option>
<option value="1998">1998</option>
<option value="1999">1999</option>
<option value="2000">2000</option>
<option value="2001">2001</option>
<option value="2002">2002</option>
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005">2005</option>
</select>
</td>
</tr>
<tr>
<td align = left>
ΑΝΤΙΓΡΑΦΑ <BR> DVD:
</td>
<td align=left>
<select name=DVD_COPIES size="1" >
<option selected value="dvd copies">dvd copies</option>
<option value=""></option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<INPUT type="CHECKBOX" name="DVD" value="DVD"> DVD**<BR>
</td>
</tr>
<tr>
<td align = left>
ΑΝΤΙΓΡΑΦΑ <BR> VHS:
</td>
<td align=left>
<select name=VHS_COPIES size="1" >
<option selected value="vhs copies">vhs copies</option>
<option value=""></option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<INPUT type="CHECKBOX" name="VHS" value="VHS"> VHS**<BR>
</td>
</tr>
<tr>
<td align = left>
ΧΡΟΝΟΣ <BR> ΕΝΟΙΚΙΑΣΗΣ:
</td>
<td align=left>
<select name=RENT_TIME size="1" >
<option selected value="rent_time">rent_time</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
</td>
</tr>
<tr>
<td align = left>
ΚΟΣΤΟΣ <BR>ΕΝΟΙΚΙΑΣΗΣ:
</td>
<td align=left>
<select name=PRICE size="1" >
<option selected value="rent_time">rent_time</option>
<option value="0.1">0.1</option>
<option value="0.2">0.2</option>
<option value="0.3">0.3</option>
<option value="0.4">0.4</option>
<option value="0.5">0.5</option>
<option value="0.6">0.6</option>
<option value="0.7">0.7</option>
<option value="0.8">0.8</option>
<option value="0.9">0.9</option>
<option value="1.0">1.0</option>
<option value="1.1">1.1</option>
<option value="1.2">1.2</option>
<option value="1.3">1.3</option>
<option value="1.4">1.4</option>
<option value="1.5">1.5</option>
<option value="1.6">1.6</option>
<option value="1.7">1.7</option>
<option value="1.8">1.8</option>
<option value="1.9">1.9</option>
<option value="2.0">2.0</option>
</select>
ΣΕ ΕΥΡΩ
</td>
</tr>
<tr>
<td align = left>
ΑΡ.ΤΑΥΤΟΤΗΤΑΣ <BR>ΕΡΓΑΖΟΜΕΝΟΥ*:
</td>
<td align=left>
<input type=text size=9 name=F_EMPLOYEE_CARD_ID MAXLENGTH=10 AUTOCOMPLETE=ON>
</td>
</tr>
<tr>
<td align = left>
<BR>ΠΕΡΙΓΡΑΦΗ:
<p>
<textarea rows="5" cols=25 name=DESCRIPTION>
</textarea>
</td>
</p>
</tr>
<tr>
<td align=center colspan=2>
<br>
<input type="submit" name=submit_bt value="ΚΑΤΑΧΩΡΗΣΗ">
<input type="reset" name=reset_bt value="ΚΑΘΑΡΙΣΜΟΣ">
</td>
</tr>
</table>
<small >
<BR>*ΣΗΜΕΙΩΣΗ:ΔΕΝ ΕΙΝΑΙ ΑΠΑΡΑΙΤΗΤΗ Η ΣΥΜΠΛΗΡΩΣΗ ΤΟΥ
<BR>**ΣΗΜΕΙΩΣΗ:ΕΙΝΑΙ ΑΠΑΡΑΙΤΗΤΗ Η ΣΥΜΠΛΗΡΩΣΗ ΤΟΥ ΕΝΟΣ ΑΠΟ ΤΑ ΔΥΟ ΠΕΔΙΑ
</small>
</form>
</font>
</center>
</body>
</html>
reg_film.php
<html>
<head>
<title>ΚΑΤΑΧΩΡΗΣΗ ΕΡΓΑΖΟΜΕΝΟΥ</title>
</head>
<body bgcolor="#6699ff">
<div align=center>
<?php
$f_id=$_POST['F_ID'];
$f_title=$_POST['F_TITLE'];
$dir_fname=$_POST['DIRECTOR_FNAME'];
$dir_fname=$_POST['DIRECTOR_LNAME'];
$type=$_POST['TYPE'];
$year_rel=$_POST['YEAR_RELEASE'];
$dvd_cop=$_POST['DVD_COPIES'];
$vhs_cop=$_POST['VHS_COPIES'];
$descr=$_POST['DESCRIPTION'];
$rent_time=$_POST['RENT_TIME'];
$price=$_POST['PRICE'];
$f_em_card_id=$_POST['F_EMPLOYEE_CARD_ID'];
$dvd=$_POST['DVD'];
$vhs=$_POST['VHS'];
$dur_hour=$_POST['DURATION_HOUR'];
$dur_min=$_POST['DURATION_MIN'];
$dur_sec=$_POST['DURATION_SEC'];
$dur=$dur_hour.':'.$dur_min.':'.$dur_sec;
$conn=mysql_connect("localhost","root",""
;
mysql_select_db("video_club",$conn);
if (!empty($f_id) && !empty($f_title) && !empty($dir_fname) && !empty($dir_fname) && !empty($type) && !empty($year_rel) && !empty($descr) && !empty($rent_time) && !empty($price) && !empty($dur) || !empty($dvd_cop) || !empty($dvd_vhs) || !empty($dvd) || !empty($dvd) || !empty($f_em_card_id))
{
// Elegxoume ti vasi na doume an iparxei idi kataxorimenh tainia me afton ton kwdiko.
// An iparxei ton dioxnoume kai tou leme pos einai idi kataxorimenh
// Allios ginete nea eggrafi
$query = "SELECT * FROM film WHERE F_ID = '$f_id'";
$rs = mysql_query($query,$conn);
$rows = mysql_num_rows($rs);
if ($rows > 0)
{
ECHO 'ΥΠΑΡΧΕΙ ΗΔΗ ΕΓΓΕΓΡΑΜΕΝΗ ΤΑΙΝΙΑ ΜΕ ΑΥΤΟΝ ΤΟΝ ΚΩΔΙΚΟ!';
ECHO "<BR>ΔΗΛΩΣΤΕ ΔΙΑΦΟΡΕΤΙΚΟ ΚΩΔΙΚΟ!";
mysql_close($conn);
ECHO "<br><a href='form_reg_film.htm'>ΕΠΙΣΤΡΟΦΗ</a>";
ECHO "<br><a href='start_page.htm'>ΑΡΧΙΚΗ ΣΕΛΙΔΑ</a>";
exit;
}
// Elegoume an iparxei idi kataxorimenh tainia me afton ton titlo
// velpe parapano
$query = "SELECT * FROM film WHERE F_TITLE = '$f_title'";
$res = mysql_query($query,$conn);
$num_rows = mysql_num_rows($res);
if ($num_rows > 0)
{
ECHO "ΥΠΑΡΧΕΙ ΗΔΗ ΕΓΓΕΓΡΑΜΕΝΗ ΤΑΙΝΙΑ ΜΕ ΑΥΤΟΝ ΤΟΝ ΤΙΤΛΟ!";
ECHO "<BR>ΔΗΛΩΣΤΕ ΔΙΑΦΟΡΕΤΙΚΟ ΤΙΤΛΟ!";
mysql_close($conn);
ECHO "<br><a href='form_reg_film.htm'>ΕΠΙΣΤΡΟΦΗ</a>";
ECHO "<br><a href='start_page.htm'>ΑΡΧΙΚΗ ΣΕΛΙΔΑ</a>";
exit;
}
if ($num_rows < 1 && $rows < 1)
{
if(getParameterValues('DVD') != null && getParameterValues('VHS') != null)
{
if($dvd_cop!= null && $vhs_cop!= null)
{
if($f_em_card_id != null)
{
$query = "INSERT INTO film(F_ID,F_TITLE,DIRECTOR_FNAME,DIRECTOR_LNAME,TYPE,DURATION,YEAR_RELEASE,DVD_COPIES,DVD,VHS_COPIES,VHS,RENT_TIME,PRICE,F_EMPLOYEE_CARD_ID,DESCRIPTION) VALUES ('$f_id','$f_title','$dir_fname', '$dir_fname','$type', '$dur' ,'$year_rel','$dvd_cop','true','$vhs_cop','true','$rent_time','$price','$f_em_card_id','$descr')";
}
else
{
$query = "INSERT INTO film(F_ID,F_TITLE,DIRECTOR_FNAME,DIRECTOR_LNAME,TYPE,DURATION,YEAR_RELEASE,DVD_COPIES,DVD,VHS_COPIES,VHS,RENT_TIME,PRICE,F_EMPLOYEE_CARD_ID,DESCRIPTION) VALUES ('$f_id','$f_title','$dir_fname', '$dir_fname','$type', '$dur' ,'$year_rel','$dvd_cop','true','$vhs_cop','true','$rent_time','$price',null,'$descr')";
}
}
else
{
ECHO "ΠΑΡΑΚΑΛΩ ΕΠΙΛΕΞΤΕ ΑΝΤΙΓΡΑΦΑ DVD ΚΑΙ ΑΝΤΙΓΡΑΦΑ VHS!";
ECHO "<br><a href='form_reg_film.htm'>ΕΠΙΣΤΡΟΦΗ</a>";
}
}
else if(req.getParameterValues("VHS"
!= null && req.getParameterValues("DVD"
== null)
{
if($vhs_cop!= null && $dvd_cop== null)
{
if($f_em_card_id != null)
{
$query = "INSERT INTO film(F_ID,F_TITLE,DIRECTOR_FNAME,DIRECTOR_LNAME,TYPE,DURATION,YEAR_RELEASE,DVD_COPIES,DVD,VHS_COPIES,VHS,RENT_TIME,PRICE,F_EMPLOYEE_CARD_ID,DESCRIPTION) VALUES ('$f_id','$f_title','$dir_fname', '$dir_fname','$type', '$dur' ,'$year_rel',null,'false','$vhs_cop','true','$rent_time','$price','$f_em_card_id','$descr')";
}
else
{
$query = "INSERT INTO film(F_ID,F_TITLE,DIRECTOR_FNAME,DIRECTOR_LNAME,TYPE,DURATION,YEAR_RELEASE,DVD_COPIES,DVD,VHS_COPIES,VHS,RENT_TIME,PRICE,F_EMPLOYEE_CARD_ID,DESCRIPTION) VALUES ('$f_id','$f_title','$dir_fname', '$dir_fname','$type', '$dur' ,'$year_rel',null,'false','$vhs_cop','true','$rent_time','$price',null,'$descr')";
}
}
else
{
ECHO "ΠΑΡΑΚΑΛΩ ΕΠΙΛΕΞΤΕ ΑΝΤΙΓΡΑΦΑ DVD ΚΑΙ ΣΤΟ VHS KAΝΕΤΕ DECHECKING!";
ECHO "<br><a href='form_reg_film.htm'>ΕΠΙΣΤΡΟΦΗ</a>";
}
}
else if(req.getParameterValues("VHS"
== null && req.getParameterValues("DVD"
!= null)
{
if($vhs_cop== null && $dvd_cop!= null)
{
if($f_em_card_id != null)
{
$query = "INSERT INTO film(F_ID,F_TITLE,DIRECTOR_FNAME,DIRECTOR_LNAME,TYPE,DURATION,YEAR_RELEASE,DVD_COPIES,DVD,VHS_COPIES,VHS,RENT_TIME,PRICE,F_EMPLOYEE_CARD_ID,DESCRIPTION) VALUES ('$f_id','$f_title','$dir_fname', '$dir_fname','$type', '$dur' ,'$year_rel','$dvd_cop','true',null,'false','$rent_time','$price','$f_em_card_id','$descr')";
}
else
{
$query = "INSERT INTO film(F_ID,F_TITLE,DIRECTOR_FNAME,DIRECTOR_LNAME,TYPE,DURATION,YEAR_RELEASE,DVD_COPIES,DVD,VHS_COPIES,VHS,RENT_TIME,PRICE,F_EMPLOYEE_CARD_ID,DESCRIPTION) VALUES ('$f_id','$f_title','$dir_fname', '$dir_fname','$type', '$dur' ,'$year_rel','$dvd_cop','true',null,'false','$rent_time','$price',null,'$descr')";
}
}
else
{
ECHO "ΠΑΡΑΚΑΛΩ ΕΠΙΛΕΞΤΕ ΑΝΤΙΓΡΑΦΑ VHS ΚΑΙ ΣΤΟ DVD KAΝΕΤΕ DECHECKING!";
ECHO "<br><a href='form_reg_film.htm'>ΕΠΙΣΤΡΟΦΗ</a>";
}
}
else
{
ECHO "ΠΑΡΑΚΑΛΩ ΕΠΙΛΕΞΤΕ ΑΝΤΙΓΡΑΦΑ VHS Ή ΑΝΤΙΓΡΑΦΑ DVD Ή ΚΑΙ ΤΑ ΔΥΟ ΚΑΙ ΚΑΝΤΕ ΤΑ ΑΝΤΙΣΤΟΙΧΑ CHECKING!";
ECHO "<br><a href='form_reg_film.htm'>ΕΠΙΣΤΡΟΦΗ</a>";
}
}
}
else
{
ECHO "ΔΕΝ ΕΧΕΤΕ ΣΥΜΠΛΗΡΩΣΕΙ ΟΛΑ ΤΑ ΑΠΑΡΑΙΤΗΤΑ ΠΕΔΙΑ!";
}
?>
<br><a href='form_reg_film.htm'>ΕΠΙΣΤΡΟΦΗ</a>
<br><a href='start_page.htm'>ΑΡΧΙΚΗ ΣΕΛΙΔΑ</a>
</div>
</body>
</html>
but no registration .....