Jump to content

Multipage form session datbase issue


liamjw

Recommended Posts

Hi,

 

I have created a multi page form using sessions but cannot seem to post the final data in to an SQL database, can anyone look at my code below and offer any help.

 

<?php

 

//let's create the query

mysql_connect

("BLAN","BLANK","BLANK");

mysql_select_db("BLANK");

$insert_query = ("insert into subscriptions (

title,

forename,

surname,

tel,

mob,

fax,

e_mail,

e_mail2,

address1,

address2,

address3,

city,

county,

post_code,

county,

baddress1,

baddress2,

baddress3,

baddress4,

bcity,

bcounty,

bpost_code,

bcountry,

nameOnCard,

card_type,

card_number,

exp_month,

exp_year,

card_verification_no,

start_month,

start_year,

issue_no"

). "VALUES (

" . $_SESSION['title'] . ",

" . $_SESSION['forename'] . ",

" . $_SESSION['surname'] . ",

" . $_SESSION['tel'] . ",

" . $_SESSION['mob'] . ",

" . $_SESSION['fax'] . ",

" . $_SESSION['e_mail'] . ",

" . $_SESSION['e_mail2'] . ",

" . $_SESSION['address1'] . ",

" . $_SESSION['address2'] . ",

" . $_SESSION['address3'] . ",

" . $_SESSION['city'] . ",

" . $_SESSION['county'] . ",

" . $_SESSION['post_code'] . ",

" . $_SESSION['country'] . ",

" . $_POST['baddress1'] . ",

" . $_POST['baddress2'] . ",

" . $_POST['baddress3'] . ",

" . $_POST['baddress4'] . ",

" . $_POST['bcity'] . ",

" . $_POST['bcounty'] . ",

" . $_POST['bpost_code'] . ",

" . $_POST['bcountry'] . ",

" . $_POST['nameOnCard'] . ",

" . $_POST['card_type'] . ",

" . $_POST['card_number'] . ",

" . $_POST['exp_month'] . ",

" . $_POST['exp_year'] . ",

" . $_POST['card_verification_no'] . ",

" . $_POST['start_month'] . ",

" . $_POST['start_year'] . ",

" . $_POST['issue_no'] . "

)");

mysql_query($insert_query);

 

?>

 

Thanks for any help that can be offered

Link to comment
Share on other sites

use [ php] [ /php] tags around the code, pls. makes it easier to read - and to find errors.

 

It's then easy to see that the parentheses ) closing the field list - is outside the quotes....

 

always echo your queries and test them...

 

<?php

//let's create the query
mysql_connect
("BLAN","BLANK","BLANK");
mysql_select_db("BLANK"); 
$insert_query = ("insert into subscriptions (
title,
forename,
surname,
tel,
mob,
fax,
e_mail,
e_mail2,
address1,
address2,
address3,
city,
county,
post_code,
county,
baddress1,
baddress2,
baddress3,
baddress4,
bcity,
bcounty,
bpost_code,
bcountry,
nameOnCard,
card_type,
card_number,
exp_month,
exp_year,
card_verification_no,
start_month,
start_year,
issue_no"
). "VALUES (
" . $_SESSION['title'] . ",
" . $_SESSION['forename'] . ",
" . $_SESSION['surname'] . ",
" . $_SESSION['tel'] . ",
" . $_SESSION['mob'] . ",
" . $_SESSION['fax'] . ",
" . $_SESSION['e_mail'] . ",
" . $_SESSION['e_mail2'] . ",
" . $_SESSION['address1'] . ",
" . $_SESSION['address2'] . ",
" . $_SESSION['address3'] . ",
" . $_SESSION['city'] . ",
" . $_SESSION['county'] . ",
" . $_SESSION['post_code'] . ",
" . $_SESSION['country'] . ",
" . $_POST['baddress1'] . ",
" . $_POST['baddress2'] . ",
" . $_POST['baddress3'] . ",
" . $_POST['baddress4'] . ",
" . $_POST['bcity'] . ",
" . $_POST['bcounty'] . ",
" . $_POST['bpost_code'] . ",
" . $_POST['bcountry'] . ",
" . $_POST['nameOnCard'] . ",
" . $_POST['card_type'] . ",
" . $_POST['card_number'] . ",
" . $_POST['exp_month'] . ",
" . $_POST['exp_year'] . ",
" . $_POST['card_verification_no'] . ",
" . $_POST['start_month'] . ",
" . $_POST['start_year'] . ",
" . $_POST['issue_no'] . "
)");
mysql_query($insert_query);

?>

Link to comment
Share on other sites

Hi, sorry about that, and thanks for your help.

 

I'm still having problems with this I have moved the parentheses inside the quotes but its still not pushing the data into the database, can you see any other erros in my code?

 

Cheers,

 

Liam.

Link to comment
Share on other sites

I used the echo $insert_query; and the session data is being displayed with no problems but it wont push the data in to the data base, I have checked every thing I can think of now but to no avail. No error messages either.

 

Liam.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.