http://dl.dropbox.com/u/11246427/naysof_template.rar
I am using XAMPP and set up my db using phpmyadmin.
above is my current project. I am trying to set up a database to this “quote” template. As you may see, most of the user’s input are the <textarea>.
I want the invoice number to be auto-increment, and when save is clicked(i made a button on other template already), it will store the data into the database. I created database, tables but i am not sure how to set this up.
Do I include all textarea in this template to a single table, or do i make 2 tables? Because I am not sure if they can be combined together(like the address, title, invoice number in one table, AND item, price and such in another table). If so, how do i define them in my database? i am using “id” when linked to css, and the guides i have found all over internet are “name”. i am not sure if its going to be any different, but I am not getting a proper database saving/calling when following the guides.
and also, the guides i have been following are using <input> as the example. not sure how to work with <textarea>.
Here is my sql statement, i got an error while executing save function,
<?php
// Connect database
mysql_connect("localhost", "root", "") or die (mysql_error());
// Select database
mysql_select_db("naysof_template") or die(mysql_error());
$strSQL = "INSERT INTO invoice_info(";
//$strSQL = $strSQL . "invoice_id, ";
$strSQL = $strSQL . "cust_address, ";
$strSQL = $strSQL . "title, ";
$strSQL = $strSQL . "date, ";
$strSQL = $strSQL . "signature_name) ";
$strSQL = $strSQL . "VALUES(";
//$strSQL = $strSQL . "' . $_POST["invoice_id"] . ', ";
$strSQL = $strSQL . "' . $_POST["cust_address"] . ', ";
$strSQL = $strSQL . "' . $_POST["title"] . ', ";
$strSQL = $strSQL . "' . $_POST["date"] . ', ";
$strSQL = $strSQL . "' . $_POST["signature_name"] . ')";
// The SQL statement is executed
mysql_query($strSQL) or die (mysql_error());
// Close the database connection
mysql_close();
<h1>The database is updated!</h1>
?>
and this is the error, i didnt understand:
Parse error: syntax error, unexpected ‘”‘, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\xampp\htdocs\naysof_template\insert.php on line 20
There’s only HTML/CSS/JS code present in your project files even though the HTML is placed in *.php files there is no actual PHP code anywhere.
HTML/CSS/JSS work on the visitors computer in the browser and they are called client-side technologies.
Apache/PHP/MySQL work on the hosting computers (the server) and they are called server-side technologies.
The client can request an item to be downloaded from the server and he will receive it (as that is the server’s default behaviour).
The client by default has no ability to store information on the server. It can send information (such as forms) to the server but they will not be saved anywhere by default.
There has to be some PHP code (that you wrote) on the server that inspects the received forms and decides what to do with them (save them in some MySQL tables for example).
Edit (now that you’re showing us your PHP code):
unexpected '"', expecting T_STRING orMeans you did not use quotes correctly here:You should be using them like this: