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
https://forums.phpfreaks.com/topic/169844-multipage-form-session-datbase-issue/
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);

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.