PDA

View Full Version : PHP/MySql help =D



Fehm
08-03-2009, 02:12 PM
Hi, I posted with some tips on my php to email form, which is now succesfully working, but ive decided to go one step further, and try playing around with it, so maybe the data that is submitted goes into a MySQL database, this is my insertinto.php file that is the action for submit in the form:


<?
include ('config.php');
if (isset($_POST['submit']));
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$sample = $_POST['sample'];

$create = mysql_query("
INSERT INTO `Apps` (`name`,`email`,`message`,`sample`
) VALUES (NULL '" . $name . "','" . $email . "''" . $message . "''" . $sample . "');");
if (!$create)
{
die("There was a problem sending your application");
} else
{
die("Thank you for application, we aim to reply within 24 hours!!");
}
?>

To you, there'll be thousands of errors. id appreciate any help on getting this to work. Just some hinters would be nice, but if its all a load of crap then, Ill start again lol

Thanks for anyone help, rep will be given where deserved and if possible!

Thank you =D
Callum

Protege
08-03-2009, 02:41 PM
Whats the error or you just want it to be made better?


include 'confg.php';

if( ! isset( $_POST[ 'Submit' ] ) )
{
exit();
}

$name = $_POST[ 'name' ];
$email = $_POST[ 'email' ];
$message = $_POST[ 'message' ];
$sample = $_POST[ 'sample' ];

$Query = mysql_query( /* Enter qurey here */ );

if( $Query )
{
echo 'Success';
}
else
{
echo 'No Success';
}

Fehm
08-03-2009, 03:11 PM
Ive fixed it now!
Thanks alot anyway, Ill +Rep :)

Want to hide these adverts? Register an account for free!