Jump to content

form submission problem


cargi

Recommended Posts

Hi guys just a quicky here i hope. I have two pages one a html form and the other the php file below. I am trying to send the data from the form into my mysql database. I am using the code below, everything seems to work fine, i mean no error messages appear... but it doesnt actually enter the data into the db please help cheers.

Cargi
www.TheMillionDollarMovieProject.com
'Become a movie producer today!'

<?

$username="xxxxx";
$password="xxxxxx";
$database="xxxx";
$host="xxxxxxxxxxxxxx";

$first=$_POST['first'];
$last=$_POST['last'];
$dob=$_POST['dob'];
$city=$_POST['city'];
$country=$_POST['country'];
$email=$_POST['email'];
$donation=$_POST['donation'];
$proNum=$_POST['proNum'];

mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$query = "INSERT INTO producers VALUES ('','$first','$last','$dob','$city','$country','$email','$donation','$proNum'";
mysql_query($query);

mysql_close();

?>
Link to comment
Share on other sites

the problem is you are not telling the query what columns to put the values in try something like this

[code]

$query="INSERT INTO producers(your_first_column_name,your_second_column_name,your_third_column_name,your_fourth_column_name,your_fifth_column_name,your_sixth_column_name, your_seventh_column_name,your_eightth_column_name,your_ninth_column_name)VALUES ('','$first','$last','$dob','$city','$country','$email','$donation','$proNum')";
mysql_query($query);
[/code]
just change all of the your_first_column_names to the real column names like(first,last,dob,and so on)and that should fix your problem and where it says &#40 it is supposed to be ( it changsd when i posted it and wont let me fix it
Link to comment
Share on other sites

Put an "or die" clause on your mysql_query() function:
[code]<?php
$query = "INSERT INTO producers VALUES ('','$first','$last','$dob','$city','$country','$email','$donation','$proNum'";
mysql_query($query) or die('Problem with query:<span style="color:red>' . $query . '</span><br>' . mysql_error());
?>[/code]

Ken
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.