Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pagina DB.php
- <?
- $host = "host:porta"; //database location
- $user = "Username"; //database username
- $pass = "password"; //database password
- $db_name = "nomeDB"; //database name
- $link = mysql_connect($host, $user, $pass);
- if (!$link)
- {
- die('impossibile connettersi: ' . mysql_error());
- }
- $db_selected = mysql_select_db($db_name, $link);
- if (!$db_selected)
- {
- die ("impossibile usare questo DB : " . mysql_error());
- }
- ?>
- Pagina elaborazione.php
- <?
- include "DB.php"
- $nome = $_POST['Nome']; /// VALORE 1 "Nome"
- $cognome = $_POST['Cognome']; /// VALORE 2 "Cognome"
- mysql_query("insert into nometabella (
- nome,
- cognome
- ) Values
- '"+$nome+"','"
- +$cognome
- +"')");
- location()
- ?>
- pagina Form.php
- <form action="elaborazione.php" method="POST">
- <label>Nome</label>
- <input type="text" name="Nome"></input> <!-- VALORE 1 "Nome" -->
- <label>Cognome</label>
- <input type="text" name="Cognome"></input> <!-- VALORE 2 "Cognome" -->
- <input type="Submit"></input>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement