Jump to content


Photo

form submission problem


  • Please log in to reply
3 replies to this topic

#1 cargi

cargi
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 25 March 2006 - 11:15 PM

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

?>

#2 azuka

azuka
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts
  • LocationNigeria

Posted 26 March 2006 - 01:07 AM

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"
Given enough eyeballs all bugs are shallow. My Website

#3 shortj75

shortj75
  • Members
  • PipPipPip
  • Advanced Member
  • 118 posts
  • LocationPort Huron,mi

Posted 26 March 2006 - 07:57 AM

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


$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);
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
The Short One

hopfully this helps if it doesn't sorry
i won't write the code for you!!! you don't learn that way

#4 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 26 March 2006 - 02:42 PM

Put an "or die" clause on your mysql_query() function:
<?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());
?>

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users