add info to database + mailform

hi, I have a mailform that e-mails me the info they fill out in a form but I want the info to be added in my database also but when I add the code to the mailform so that it will I get this error

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in /home/planetzi/public_html/leveling/mailform.php on line 26

the mailform looks like this


Mailform <?php

$to = “[email protected]”;
$subject = $_POST[“subject”] ;
$message = “MSN: {$_POST[‘msn’]}nnn{$_POST[‘message’]}nnLeveler: {$_POST[‘leveler’]}nVocation: {$_POST[‘select1’]}nCurrent Level: {$_POST[‘select2’]}nDesired Level: {$_POST[‘select3’]}nWorld type: {$_POST[‘select4’]}nAccount Status: {$_POST[‘select5’]}nSkills: {$_POST[‘select6’]}nMagic level: {$_POST[‘select7’]}nEquipment: {$_POST[‘select8’]}”;
$from = “Leveling Order”;
$headers = “From: $from”;

$con = mysql_connect(“localhost”,“xxxxxxxxxxx”,“xxxxxxxxxxxx”);
if (!$con)
die('Could not connect: ’ . mysql_error());

mysql_select_db(“xxxxxxx”, $con);

$sql=“INSERT INTO orders (login, vocation, current level, desired level, world type, prem, skills, mag, eq, msn, leveler, Order status)
(’$_POST[login]’,’$_POST[select1]’,’$_POST[select2]’,’$_POST[select3]’,’$_POST[select4]’,’$_POST[select5]’,’$_POST[select6]’,’$_POST[select7]’,’$_POST[select8]’,’$_POST[msn]’,’$_POST[leveler]’,’$_POST[order status]’)”;

if (!mysql_query($sql,$con))
die('Error: ’ . mysql_error());
echo “Thank you for using my mail form //Gatsu”;




might you know what I am doing wrong?
please teach me! :)

what is in line 26? the way u pasted it line 26 is empty!

i would use no arrays inside strings:

cange “abc{$foo[‘bar’]}xyz” and “abc$foo[bar]xyz”
to “abc”.$foo[‘bar’].“xyz”

line 26 was [php](’$_POST[login]’,’$_POST[select1]’,’$_POST[select2]’,’$_POST[select3]’,’$_POST[select4]’,’$_POST[select5]’,’$_POST[select6]’,’$_POST[select7]’,’$_POST[select8]’,’$_POST[msn]’,’$_POST[leveler]’,’$_POST[order status]’)";[/php]

the problem was $_POST[order status] (the blank), but if u changed it to “.$_POST[‘order status’].” like i told u, it should be gone already.

Sponsor our Newsletter | Privacy Policy | Terms of Service