Baza wygląda tak:
Kod
CREATE TABLE jff_base (
jff_id INT NOT NULL AUTO_INCREMENT,
jff_date DATE,
jff_enteredby TEXT,
jff_name TEXT,
jff_address TEXT,
jff_inv_address TEXT,
jff_landline TEXT,
jff_mobile TEXT,
jff_req TEXT,
jff_qty INT,
jff_height INT,
jff_width INT,
jff_thick INT,
jff_per_sqr INT,
jff_man INT,
jff_hours INT,
jff_per_hour INT,
jff_costumer_decision TEXT,
jff_measure_by VARCHAR(32),
jff_ok TINYINT,
PRIMARY KEY(jff_id));
jff_id INT NOT NULL AUTO_INCREMENT,
jff_date DATE,
jff_enteredby TEXT,
jff_name TEXT,
jff_address TEXT,
jff_inv_address TEXT,
jff_landline TEXT,
jff_mobile TEXT,
jff_req TEXT,
jff_qty INT,
jff_height INT,
jff_width INT,
jff_thick INT,
jff_per_sqr INT,
jff_man INT,
jff_hours INT,
jff_per_hour INT,
jff_costumer_decision TEXT,
jff_measure_by VARCHAR(32),
jff_ok TINYINT,
PRIMARY KEY(jff_id));
Kod mojego formularza w pliku: add.php wygląda tak (przepisywałem z książki):
Kod
<?php
if(isset($submit)):
$db = mysql_connect("tutaj mam wpisany adres bazy", "nazwę bazy", "hasło");
mysql_select_db("fs_glass", $db);
$date = date("Y-m-d");
$sql = "INSERT INTO jff_base
VALUES (NULL, 'jff_date', 'jff_enteredby', 'jff_name', jff_address', 'jff_inv_address', 'jff_landline', 'jff_mobile', 'jff_req', 'jff_qty', 'jff_height', 'jff_width', 'jff_thick', 'jff_per_sqr', 'jff_man', 'jff_hours', 'jff_per_hour', 'jff_costumer_decision', 'jff_measure_by', 'jff_ok')";
mysql_query($sql);
print("<h2>Job Added</h2>\n");
print("<b>Add next job below. We don't like to do nothing... Are we?</b>\n");
endif;
?>
<p><h3>Add new job to our database</h3>
<form action="add.php" method="post">
JobID (leave blank): <input type="text" name="jff_id"><p>
Date (ex. 2009-12-23): <input type="text" name="jff_date"><p>
Entered by: <input type="text" name="jff_enteredby"><p>
Client/Company name: <input type="text" name="jff_name"><p>
Address: <input type="text" name="jff_address"><p>
Invoice address: <input type="text" name="jff_inv_address"><p>
Landline: <input type="text" name="jff_landline"><p>
Mobile: <input type="text" name="jff_mobile"><p>
Requirements: <br /><textarea cols=60 rows=7 name="jff_req" wrap="virtual"></textarea><p>
Qty.: <input type="text" name="jff_qty"><p>
Height: <input type="text" name="jff_height"><p>
Widht: <input type="text" name="jff_width"><p>
Thick: <input type="text" name="jff_thick"><p>
Per sqr.: <input type="text" name="jff_per_sqr"><p>
Man: <input type="text" name="jff_man"><p>
How many hours: <input type="text" name="jff_hours"><p>
Per hour: <input type="text" name="jff_per_hour"><p>
Costumer decision: <input type="text" name="jff_costumer_decision"><p>
Measured by: <input type="text" name="jff_measured_by"><p>
Ok?: <input type="text" name="jff_ok">
<p>
<input type="submit" name="submit" value="Add job!">
</form>
if(isset($submit)):
$db = mysql_connect("tutaj mam wpisany adres bazy", "nazwę bazy", "hasło");
mysql_select_db("fs_glass", $db);
$date = date("Y-m-d");
$sql = "INSERT INTO jff_base
VALUES (NULL, 'jff_date', 'jff_enteredby', 'jff_name', jff_address', 'jff_inv_address', 'jff_landline', 'jff_mobile', 'jff_req', 'jff_qty', 'jff_height', 'jff_width', 'jff_thick', 'jff_per_sqr', 'jff_man', 'jff_hours', 'jff_per_hour', 'jff_costumer_decision', 'jff_measure_by', 'jff_ok')";
mysql_query($sql);
print("<h2>Job Added</h2>\n");
print("<b>Add next job below. We don't like to do nothing... Are we?</b>\n");
endif;
?>
<p><h3>Add new job to our database</h3>
<form action="add.php" method="post">
JobID (leave blank): <input type="text" name="jff_id"><p>
Date (ex. 2009-12-23): <input type="text" name="jff_date"><p>
Entered by: <input type="text" name="jff_enteredby"><p>
Client/Company name: <input type="text" name="jff_name"><p>
Address: <input type="text" name="jff_address"><p>
Invoice address: <input type="text" name="jff_inv_address"><p>
Landline: <input type="text" name="jff_landline"><p>
Mobile: <input type="text" name="jff_mobile"><p>
Requirements: <br /><textarea cols=60 rows=7 name="jff_req" wrap="virtual"></textarea><p>
Qty.: <input type="text" name="jff_qty"><p>
Height: <input type="text" name="jff_height"><p>
Widht: <input type="text" name="jff_width"><p>
Thick: <input type="text" name="jff_thick"><p>
Per sqr.: <input type="text" name="jff_per_sqr"><p>
Man: <input type="text" name="jff_man"><p>
How many hours: <input type="text" name="jff_hours"><p>
Per hour: <input type="text" name="jff_per_hour"><p>
Costumer decision: <input type="text" name="jff_costumer_decision"><p>
Measured by: <input type="text" name="jff_measured_by"><p>
Ok?: <input type="text" name="jff_ok">
<p>
<input type="submit" name="submit" value="Add job!">
</form>
Niestety po kliknięciu w Add job! formularz pojawia się jeszcze raz i niczego nie dopisuje w bazie.
Bardzo Was proszę o pomoc we wskazaniu mi błędu.
