Then as shown below I capture the data using PHP.
the data is getting captured in the variables no prob with that.
but the data isn't getting saved to the database.
it should have something to do with my if cluases. pls let me knw the error.
thanks in advance...!!!! :)
Expand|Select|Wrap|Line Numbers
- <?php
- if (isset($_POST['btnok']))
- {
- $image_id = $_GET['id'];
- $title = $_POST['lsttitle'];
- $fname = $_POST['txtfname'];
- $lname = $_POST['txtlname'];
- $email = $_POST['txtemail'];
- $message = $_POST['txtmessage'];
- echo "$title........";
- echo"<br />";
- $db_host = 'localhost';
- $db_user = 'root';
- $db_pwd = 'dba';
- $database = 'gallery';
- if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database");
- if (!mysql_select_db($database)) die("Can't select database");
- if ($message==null or $fname==null)
- {
- echo "Please fill all required fields";
- }
- elseif ($fname==null or $lname==null)
- {
- echo "Please fill all required fields";
- }
- else
- {
- $result = mysql_query("insert into inquiries(i_inq_title, i_inq_fname, i_inq_lname, i_inq_email, i_inq_message, i_inq_painting_id) values ('".$title."', '".$fname."', '".$lname."', '".$email."', '".$message."', '".$image_id."')") or die("MYSQL Returned: ". mysql_error());
- if($result==false)
- {
- echo "Couldnt complete the inquiry please try again!";
- }
- else
- {
- echo"did it";
- //mysql_close();
- }
- }
- }
- ?>