View Single Post
  #7 (permalink)  
Old April 7th, 2017, 01:14 PM
italia47 italia47 is offline
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2017
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Create a file with a form with table entries (people_fullname, people_isactor, people_isdirector) insert_people.php create a file with INSERT INTO queries.
Obviously includes with connection file, and any header ( 'location: filedel form');
I have done so:
file: people.php
PHP Code:
<?php
include('conn.php');
?>
<!DOCTYPE html>
<html>
<head>
    <title>DATABASE dei FILM</title>
    <style type="text/css">
    th{background-color: #999;}    
    .odd_row {background-color: #EEE;}
    .even_row{background-color: #FFF;}
    </style>
</head>
<body>
<h1 align="center" style="margin-top: 50px;"><em>Inserimento Attori - Registi</em></h1>
<form style="margin-top:150px;  margin-top:150; width: 70%;margin-left:auto; margin-right:auto; border: dotted #efefef 1px;" action="insert_people.php" method="post">
<fieldset>
<legend> Form inserimento</legend>
<br>
<label>Nome e cognome attore o regista</label><br>
<input type="text" name="people_fullname"><br>

<label>Specificare se Attore principale</label>    <br>
<input type="text" name="people_isactor" placeholder="Codice 1 se attore - codice 0 se regista"><br>

<label>Specificare se Regista</label>    <br>
<input type="text" name="people_isdirector" placeholder="Codice 0 se attore - codice 1 se regista"><br>

<input type="submit" name="submit" value="INSERISCI">

</fieldset>
</form>
</body>
</html>
File insert_people.php
PHP Code:

<?php
include('conn.php');

$people_fullname  $_POST['people_fullname'];
$people_isactor  $_POST['people_isactor'];
$people_isdirector$_POST['people_isdirector'];



$query "INSERT INTO people (people_fullname, people_isactor,people_isdirector) 
VALUES 
('$people_fullname', '$people_isactor' ,'$people_isdirector')"
;

$result mysql_query($query);

if(
$result) {
    
header('location:people.php');
}
?>
I hope I was of aiuto..anche though as I used Italian terms of my tongue.
let me know ... and good luck!
Reply With Quote