Undrium;10983329 wrote:
Your $POSTs are wrong, should look like this instead:
$_POST['difficulttrust']
No they should not.
# correct outside of string literals
$_POST['key'];
#correct with string interpolation
"$_POST[key]";
# also correct with string interpolation
"{$_POST['key']}";
There is no parse error in the posted code, so either you're not looking at the right file, or have changed something before posting.
However, you must make user input safe. From the looks of your code, your variables can take one of two values, which can be handled by true/false, or should your db lack a boolean datatype, 0 and non-zero. Yet, you treat the input as strings.
If you do use strings,
# this is a must
$_POST['somefield'] = mysql_real_escape_string($_POST['somefield']);
But a better solution would be to give those post variables '0' and '1' values and
$sql=sprintf("INSERT INTO `Emotional`
(It_is_difficult_for_me_to_let_people_get_emotionally_close_to_me, I_sometimes_find_it_difficult_to_trust_people,
Try_not_to_dwell_on_an_issue_once_it_is_resolved,
Show_that_my_partner_needs_are_important,
The_friendship_between_me_and_my_partner,
Being_able_to_make_compromises)
VALUES (%d,%d,%d,%d,%d,%d)",
$_POST['longterm'],
$_POST['difficulttrust'],
$_POST['dwellonissue'],
$_POST['partnerneeds'],
$_POST['friendshippartner'],
$_POST['makecompromises']);