Jump to content

Archived

This topic is now archived and is closed to further replies.

cargi

form submission problem

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();

?>

Share this post


Link to post
Share on other sites
Are you sure short tags are enabled on your server? Try calling echo () from inside the block. If it doesn't work then you should chnage "<?" to "<?php"

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

×

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.