Forum Moderators: coopster

Message Too Old, No Replies

Form to database not working, Please help.

         

GordonEngquist

2:36 pm on Apr 30, 2007 (gmt 0)

10+ Year Member



Hello,
My name is Gordon and I am going out of my mind trying to resolve this. I am trying to implement an online registration form for my parish. I have the table created at my host site, when I run a connectivity .php to see if I can connect, I get no errors. However, when I try to submit the data from the form, I get an Error 404: NOT FOUND! on my browser. I am new to PHP and have spent the better part of the past week researching this but to no avail.
You would fill in the form (TestRegistration.html) then click "Submit". It is supposed to call Insert.php and (I assume) post the data into my database. When I click "Submit" the browser address changes to www.mysiteroot.org/insert.php with the Error 404. It acts as if it is trying to load a page that does not exist. I am posting my code in hopes I can get this resolved. I will thank you in advance for any help provided.

The HTML form page is quite large so I am removing the actual form table code. If I need to post that I will.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Parish Registration</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<img src="graphics/stt.banner2.gif" width="1000" height="175" />

<form method="post" action="insert.php" >

---REMOVED FOR POSTING OF MESSAGE---

<input type="submit" value="Submit" name="B1"></a><input type="reset" value="Reset" name="B2"></p>
</form>

and my Insert.php file is this.

<?php
/* Start of PHP3 Script */
/* Data of SQL-server */
$server= "myserver"; /* Address of database server */
$user= "myuserid"; /* Database username */
$_Password= "mypassword"; /* Database Password */
$database= "mydatabase"; /* name of database */
$table= "Member"; /* Name of table, you can select that */
$FamLast= $_POST['Family_Last'];
$famphone= $_POST['Family_Phone'];
$famlist= $_POST['Family_List'];
$famaddy= $_POST['Family_Address'];
$famcity= $_POST['Family_City'];
$famstate= $_POST['Family_State'];
$famzip= $_POST['Family_Zip'];
$hohfirst= $_POST['HOH_First'];
$hohmiddle= $_POST['HOH_Middle'];
$hohmaiden= $_POST['HOH_Maiden'];
$hohdob= $_POST['HOH_Birth'];
$hohrelig= $_POST['HOH_Religion'];
$hohprac= $_POST['HOH_Practicing'];
$hohbapt= $_POST['HOH_Baptised'];
$hohcath= $_POST['HOH_Bapcath'];
$hohcomm= $_POST['HOH_Cathcomm'];
$hohconf= $_POST['HOH_Confirm'];
$hohpof= $_POST['HOH_ProfFaith'];
$hohpofw= $_POST['HOH_POFwhen'];
$hohemp= $_POST['HOH_Employment'];
$hohtitle= $_POST['HOH_Title'];
$hohgrade= $_POST['HOH_Grade'];
$hohemp= $_POST['HOH_Employer'];
$hohwkph= $_POST['HOH_WkPhone'];
$spfirst= $_POST['SP_First'];
$spmiddle= $_POST['SP_Middle'];
$spmaiden= $_POST['SP_Maiden'];
$spdob= $_POST['SP_Birth'];
$sprelig= $_POST['SP_Religion'];
$spprac= $_POST['SP_Practicing'];
$spbapt= $_POST['SP_Baptised'];
$spcath= $_POST['SP_Bapcath'];
$spcomm= $_POST['SP_Cathcomm'];
$spconf= $_POST['SP_Confirm'];
$sppof= $_POST['SP_ProfFaith'];
$sppofw= $_POST['SP_POFwhen'];
$spemp= $_POST['SP_Employment'];
$sptitle= $_POST['SP_Title'];
$spgrade= $_POST['SP_Grade'];
$spemp= $_POST['SP_Employer'];
$spwkph= $_POST['SP_WkPhone'];
$marstat= $_POST['Mar_Status'];
$mardate= $_POST['MAR_Date'];
$marcath= $_POST['MAR_Cath'];
$marnote= $_POST['MAR_Note'];
$oth1name= $_POST['OTH1_Name'];
$oth1rel= $_POST['OTH1_Relation'];
$oth1sex= $_POST['OTH1_Sex'];
$oth1dob= $_POST['OTH1_DOB'];
$oth1cathbap= $_POST['OTH1_Baptism'];
$oth1comm= $_POST['OTH1_Communion'];
$oth1conf= $_POST['OTH1_Confirmation'];
$oth1sch= $_POST['OTH1_School'];
$oth1grd= $_POST['OTH1_Grade'];
$oth2name= $_POST['OTH2_Name'];
$oth2rel= $_POST['OTH2_Relation'];
$oth2sex= $_POST['OTH2_Sex'];
$oth2dob= $_POST['OTH2_DOB'];
$oth2cathbap= $_POST['OTH2_Baptism'];
$oth2comm= $_POST['OTH2_Communion'];
$oth2conf= $_POST['OTH2_Confirmation'];
$oth2sch= $_POST['OTH2_School'];
$oth2grd= $_POST['OTH2_Grade'];
$oth3name= $_POST['OTH3_Name'];
$oth3rel= $_POST['OTH3_Relation'];
$oth3sex= $_POST['OTH3_Sex'];
$oth3dob= $_POST['OTH3_DOB'];
$oth3cathbap= $_POST['OTH3_Baptism'];
$oth3comm= $_POST['OTH3_Communion'];
$oth3conf= $_POST['OTH3_Confirmation'];
$oth3sch= $_POST['OTH3_School'];
$oth3grd= $_POST['OTH3_Grade'];
$oth4name= $_POST['OTH4_Name'];
$oth4rel= $_POST['OTH4_Relation'];
$oth4sex= $_POST['OTH4_Sex'];
$oth4dob= $_POST['OTH4_DOB'];
$oth4cathbap= $_POST['OTH4_Baptism'];
$oth4comm= $_POST['OTH4_Communion'];
$oth4conf= $_POST['OTH4_Confirmation'];
$oth4sch= $_POST['OTH4_School'];
$oth4grd= $_POST['OTH4_Grade'];
$oth5name= $_POST['OTH5_Name'];
$oth5rel= $_POST['OTH5_Relation'];
$oth5sex= $_POST['OTH5_Sex'];
$oth5dob= $_POST['OTH5_DOB'];
$oth5cathbap= $_POST['OTH5_Baptism'];
$oth5comm= $_POST['OTH5_Communion'];
$oth5conf= $_POST['OTH5_Confirmation'];
$oth5sch= $_POST['OTH5_School'];
$oth5grd= $_POST['OTH5_Grade'];
$opnation= $_POST['Op_Nationality'];
$opspneed= $_POST['Op_SpecNeeds'];
$opsnhelp= $_POST['Op_SpecHelp'];
$ophandi= $_POST['Op_Handicap'];
$ophandhelp= $_POST['Op_HandHelp'];
$opnote= $_POST['Op_Note'];

/* Accessing SQL-server */
MYSQL_CONNECT($server, $user, $_Password) or die ( "<H3>Server unreachable</H3>");
MYSQL_SELECT_DB($database) or die ( "<H3>Database non existent</H3>");

/* Entering the values */
$query = "INSERT INTO $table VALUES(",'$FamLast', '$famphone', '$famlist', '$famaddy', '$famcity', '$famstate', '$famzip', '$hohfirst', '$hohmiddle', '$hohmaiden', '$hohdob', '$hohrelig', '$hohprac', '$hohbapt', '$hohcath', '$hohcomm', '$hohconf', '$hohpof', '$hohpofw', '$hohemp', '$hohtitle', '$hohgrade', '$hohemp', '$hohwkph', '$spfirst', '$spmiddle', '$spmaiden', '$spdob', '$sprelig', '$spprac', '$spbapt', '$spcath', '$spcomm', '$spconf', '$sppof', '$sppofw', '$spemp', '$sptitle', '$spgrade', '$spemp', '$spwkph', '$marstat', '$mardate', '$marcath', '$marnote', '$oth1name', '$oth1rel', '$oth1sex', '$oth1dob', '$oth1cathbap', '$oth1comm', '$oth1conf', '$oth1sch', '$oth1grd', '$oth2name', '$oth2rel', '$oth2sex', '$oth2dob', '$oth2cathbap', '$oth2comm', '$oth2conf', '$oth2sch', '$oth2grd', '$oth3name', '$oth3rel', '$oth3sex', '$oth3dob', '$oth3cathbap', '$oth3comm', '$oth3conf', '$oth3sch', '$oth3grd', '$oth4name', '$oth4rel', '$oth4sex', '$oth4dob', '$oth4cathbap', '$oth4comm', '$oth4conf', '$oth4sch', '$oth4grd', '$oth5name', '$oth5rel', '$oth5sex', '$oth5dob', '$oth5cathbap', '$oth5comm', '$oth5conf', '$oth5sch', '$oth5grd', '$opnation', '$opspneed', '$opsnhelp', '$ophandi', '$ophandhelp', '$opnote')");
MYSQL_QUERY($query)

/* Display number of entries */
$number=MYSQL_NUMROWS(MYSQL_QUERY( "SELECT * FROM $table"));
if ($number==0):
echo "database empty";
elseif ($number > 0):
echo "$number rows in database";
endif;

/* Close SQL-Connection */
MYSQL_CLOSE();
?>

So there it is, what am I missing?

[edited by: jatar_k at 3:02 pm (utc) on April 30, 2007]
[edit reason] fixed sidescroll and specifics [/edit]

jatar_k

3:04 pm on Apr 30, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld GordonEngquist,

your form tag implies that insert.php is located in the same folder as your reg form, is that actually the case?

some other thoughts

all php functions should be lowercase

when you use an 'or die' statement always include the error from mysql like so

mysql_connect($server, $user, $_Password) or die ( "<H3>Server unreachable" . mysql_error() . "</H3>");
mysql_select_db($database) or die ( "<H3>Database non existent" . mysql_error() . "</H3>");

you might as well use mysql_num_rows instead of MYSQL_NUMROWS as mysql_num_rows is the real function, the other is just an alias.

jatar_k

3:11 pm on Apr 30, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you also need a semi colon after this line

MYSQL_QUERY($query)

and you can add an or die there as well

mysql_query($query) or die ('<p>insert query failed: ' . mysql_error());

you can change your if statement syntax as well from

if ($number==0):
echo "database empty";
elseif ($number > 0):
echo "$number rows in database";
endif;

to

if ($number <= 0){
echo "database empty";
} else {
echo "$number rows in database";
}

this way the if covers 0 or less and the else can just be executed otherwise, no need for the if else

<added>I've never tried this

$number=MYSQL_NUMROWS(MYSQL_QUERY( "SELECT * FROM $table"));

so I am not sure if you can nest that. I usually do it in a couple steps

$result = mysql_query('select * from ' . $table) or die ('<p>select died: ' . mysql_error());
$number = mysql_num_rows($result);

GordonEngquist

3:41 pm on Apr 30, 2007 (gmt 0)

10+ Year Member



Thank you jatar for you response. The insert.php and TestRegistration.html are in the same directory. I went through and made the changes that you suggested, but it still does the same thing. Any other ideas? I can give you the actual address so you can look at what I am talking about if you wish.

jatar_k

3:47 pm on Apr 30, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



your actual form says 'insert1.php' not insert.php ;)

you're also oging to find an error message once you get it to submit

GordonEngquist

3:50 pm on Apr 30, 2007 (gmt 0)

10+ Year Member



That has been changed jatar to reflect the proper insert.php. Was testing something earlier and did not want to overwrite my file. However, same results... you say I will receive error if data is successfully entered into the db?

jatar_k

3:53 pm on Apr 30, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you should change the filename of insert.php, it actually has a capitol I

change the name of the actual file to insert.php (all lowercase) and it should post correctly

it is a good habit to make filenames that are all lowercase

GordonEngquist

3:59 pm on Apr 30, 2007 (gmt 0)

10+ Year Member



HOLY COW!
So now it is insert.php and I have the following error....

Parse error: parse error, unexpected ',' in /homepages/10/d202105791/htdocs/insert.php on line 112

Line 112 is as follows;

$query = "INSERT INTO $table VALUES(",'$FamLast', '$famphone', '$famlist', '$famaddy', '$famcity', '$famstate', '$famzip', '$hohfirst', '$hohmiddle', '$hohmaiden', '$hohdob', '$hohrelig', '$hohprac', '$hohbapt', '$hohcath', '$hohcomm', '$hohconf', '$hohpof', '$hohpofw', '$hohemp', '$hohtitle', '$hohgrade', '$hohemp', '$hohwkph', '$spfirst', '$spmiddle', '$spmaiden', '$spdob', '$sprelig', '$spprac', '$spbapt', '$spcath', '$spcomm', '$spconf', '$sppof', '$sppofw', '$spemp', '$sptitle', '$spgrade', '$spemp', '$spwkph', '$marstat', '$mardate', '$marcath', '$marnote', '$oth1name', '$oth1rel', '$oth1sex', '$oth1dob', '$oth1cathbap', '$oth1comm', '$oth1conf', '$oth1sch', '$oth1grd', '$oth2name', '$oth2rel', '$oth2sex', '$oth2dob', '$oth2cathbap', '$oth2comm', '$oth2conf', '$oth2sch', '$oth2grd', '$oth3name', '$oth3rel', '$oth3sex', '$oth3dob', '$oth3cathbap', '$oth3comm', '$oth3conf', '$oth3sch', '$oth3grd', '$oth4name', '$oth4rel', '$oth4sex', '$oth4dob', '$oth4cathbap', '$oth4comm', '$oth4conf', '$oth4sch', '$oth4grd', '$oth5name', '$oth5rel', '$oth5sex', '$oth5dob', '$oth5cathbap', '$oth5comm', '$oth5conf', '$oth5sch', '$oth5grd', '$opnation', '$opspneed', '$opsnhelp', '$ophandi', '$ophandhelp', '$opnote')");

does that ") need to come off at the end? I I have the (", at the begining because the first field is an auto numbering key, is that correct?

[edited by: jatar_k at 4:11 pm (utc) on April 30, 2007]
[edit reason] fixed sidescroll [/edit]

jatar_k

4:11 pm on Apr 30, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



yes the ") should come off, you only need one there

>> because the first field is an auto numbering key, is that correct?

yes it is

<added>I keep adding commas between your vars so that line of code will wrap. ;)

GordonEngquist

4:30 pm on Apr 30, 2007 (gmt 0)

10+ Year Member



I will work on not stretching those out anymore... I removed the ") from the end but still received the same error. At the beginning of the text, I changed (", to ('', and it moved forward to the next parse error.

Unexpected T_STRING in line 115.

That is the line I changed MYSQL_NUMROWS to mysql_num_rows

jatar_k

4:40 pm on Apr 30, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I think in your insert query it may have been a double " quote instead of two single quotes ''

here's what I have

<?php
// Data of SQL-server
$server= "myserver"; /* Address of database server */
$user= "myuserid"; /* Database username */
$_Password= "mypassword"; /* Database Password */
$database= "mydatabase"; /* name of database */
$table= "Member"; /* Name of table, you can select that */

// form variables
$FamLast= $_POST['Family_Last'];
$famphone= $_POST['Family_Phone'];
$famlist= $_POST['Family_List'];
$famaddy= $_POST['Family_Address'];
$famcity= $_POST['Family_City'];
$famstate= $_POST['Family_State'];
$famzip= $_POST['Family_Zip'];
$hohfirst= $_POST['HOH_First'];
$hohmiddle= $_POST['HOH_Middle'];
$hohmaiden= $_POST['HOH_Maiden'];
$hohdob= $_POST['HOH_Birth'];
$hohrelig= $_POST['HOH_Religion'];
$hohprac= $_POST['HOH_Practicing'];
$hohbapt= $_POST['HOH_Baptised'];
$hohcath= $_POST['HOH_Bapcath'];
$hohcomm= $_POST['HOH_Cathcomm'];
$hohconf= $_POST['HOH_Confirm'];
$hohpof= $_POST['HOH_ProfFaith'];
$hohpofw= $_POST['HOH_POFwhen'];
$hohemp= $_POST['HOH_Employment'];
$hohtitle= $_POST['HOH_Title'];
$hohgrade= $_POST['HOH_Grade'];
$hohemp= $_POST['HOH_Employer'];
$hohwkph= $_POST['HOH_WkPhone'];
$spfirst= $_POST['SP_First'];
$spmiddle= $_POST['SP_Middle'];
$spmaiden= $_POST['SP_Maiden'];
$spdob= $_POST['SP_Birth'];
$sprelig= $_POST['SP_Religion'];
$spprac= $_POST['SP_Practicing'];
$spbapt= $_POST['SP_Baptised'];
$spcath= $_POST['SP_Bapcath'];
$spcomm= $_POST['SP_Cathcomm'];
$spconf= $_POST['SP_Confirm'];
$sppof= $_POST['SP_ProfFaith'];
$sppofw= $_POST['SP_POFwhen'];
$spemp= $_POST['SP_Employment'];
$sptitle= $_POST['SP_Title'];
$spgrade= $_POST['SP_Grade'];
$spemp= $_POST['SP_Employer'];
$spwkph= $_POST['SP_WkPhone'];
$marstat= $_POST['Mar_Status'];
$mardate= $_POST['MAR_Date'];
$marcath= $_POST['MAR_Cath'];
$marnote= $_POST['MAR_Note'];
$oth1name= $_POST['OTH1_Name'];
$oth1rel= $_POST['OTH1_Relation'];
$oth1sex= $_POST['OTH1_Sex'];
$oth1dob= $_POST['OTH1_DOB'];
$oth1cathbap= $_POST['OTH1_Baptism'];
$oth1comm= $_POST['OTH1_Communion'];
$oth1conf= $_POST['OTH1_Confirmation'];
$oth1sch= $_POST['OTH1_School'];
$oth1grd= $_POST['OTH1_Grade'];
$oth2name= $_POST['OTH2_Name'];
$oth2rel= $_POST['OTH2_Relation'];
$oth2sex= $_POST['OTH2_Sex'];
$oth2dob= $_POST['OTH2_DOB'];
$oth2cathbap= $_POST['OTH2_Baptism'];
$oth2comm= $_POST['OTH2_Communion'];
$oth2conf= $_POST['OTH2_Confirmation'];
$oth2sch= $_POST['OTH2_School'];
$oth2grd= $_POST['OTH2_Grade'];
$oth3name= $_POST['OTH3_Name'];
$oth3rel= $_POST['OTH3_Relation'];
$oth3sex= $_POST['OTH3_Sex'];
$oth3dob= $_POST['OTH3_DOB'];
$oth3cathbap= $_POST['OTH3_Baptism'];
$oth3comm= $_POST['OTH3_Communion'];
$oth3conf= $_POST['OTH3_Confirmation'];
$oth3sch= $_POST['OTH3_School'];
$oth3grd= $_POST['OTH3_Grade'];
$oth4name= $_POST['OTH4_Name'];
$oth4rel= $_POST['OTH4_Relation'];
$oth4sex= $_POST['OTH4_Sex'];
$oth4dob= $_POST['OTH4_DOB'];
$oth4cathbap= $_POST['OTH4_Baptism'];
$oth4comm= $_POST['OTH4_Communion'];
$oth4conf= $_POST['OTH4_Confirmation'];
$oth4sch= $_POST['OTH4_School'];
$oth4grd= $_POST['OTH4_Grade'];
$oth5name= $_POST['OTH5_Name'];
$oth5rel= $_POST['OTH5_Relation'];
$oth5sex= $_POST['OTH5_Sex'];
$oth5dob= $_POST['OTH5_DOB'];
$oth5cathbap= $_POST['OTH5_Baptism'];
$oth5comm= $_POST['OTH5_Communion'];
$oth5conf= $_POST['OTH5_Confirmation'];
$oth5sch= $_POST['OTH5_School'];
$oth5grd= $_POST['OTH5_Grade'];
$opnation= $_POST['Op_Nationality'];
$opspneed= $_POST['Op_SpecNeeds'];
$opsnhelp= $_POST['Op_SpecHelp'];
$ophandi= $_POST['Op_Handicap'];
$ophandhelp= $_POST['Op_HandHelp'];
$opnote= $_POST['Op_Note'];

/* Accessing SQL-server */
mysql_connect($server, $user, $_Password) or die ( "<H3>Server unreachable" . mysql_error() . "</H3>");
mysql_select_db($database) or die ( "<H3>Database non existent" . mysql_error() . "</H3>");

/* Entering the values */
$query = "INSERT INTO $table VALUES('','$FamLast', '$famphone', '$famlist', '$famaddy', '$famcity', '$famstate', '$famzip', '$hohfirst', '$hohmiddle', '$hohmaiden', '$hohdob', '$hohrelig', '$hohprac', '$hohbapt', '$hohcath', '$hohcomm', '$hohconf', '$hohpof', '$hohpofw', '$hohemp', '$hohtitle', '$hohgrade', '$hohemp', '$hohwkph', '$spfirst', '$spmiddle', '$spmaiden', '$spdob', '$sprelig', '$spprac', '$spbapt', '$spcath', '$spcomm', '$spconf', '$sppof', '$sppofw', '$spemp', '$sptitle', '$spgrade', '$spemp', '$spwkph', '$marstat', '$mardate', '$marcath', '$marnote', '$oth1name', '$oth1rel', '$oth1sex', '$oth1dob', '$oth1cathbap', '$oth1comm', '$oth1conf', '$oth1sch', '$oth1grd', '$oth2name', '$oth2rel', '$oth2sex', '$oth2dob', '$oth2cathbap', '$oth2comm', '$oth2conf', '$oth2sch', '$oth2grd', '$oth3name', '$oth3rel', '$oth3sex', '$oth3dob', '$oth3cathbap', '$oth3comm', '$oth3conf', '$oth3sch', '$oth3grd', '$oth4name', '$oth4rel', '$oth4sex', '$oth4dob', '$oth4cathbap', '$oth4comm', '$oth4conf', '$oth4sch', '$oth4grd', '$oth5name', '$oth5rel', '$oth5sex', '$oth5dob', '$oth5cathbap', '$oth5comm', '$oth5conf', '$oth5sch', '$oth5grd', '$opnation', '$opspneed', '$opsnhelp', '$ophandi', '$ophandhelp', '$opnote')";
mysql_query($query);

/* Display number of entries */
$result = mysql_query('select * from ' . $table) or die ('<p>select died: ' . mysql_error());
$number = mysql_num_rows($result);

if ($number <= 0){
echo "database empty";
} else {
echo "$number rows in database";
}

/* Close SQL-Connection */
mysql_close();
?>

man is that ever a lot of fields

GordonEngquist

5:07 pm on Apr 30, 2007 (gmt 0)

10+ Year Member



It was a double quote. I thought, well everything else is in single, why not this..

I was messing around with creating a few tables and creating the relationships, but for what this is doing, I did not want to waste a bunch of time working with it. I know a bit about databases, but not enough to whip one out in an afternoon.

Well, I removed everything after the query to post the data into the db just to see if it would at lease create the record.

All that remains is

/* Close SQL-Connection */
mysql_close();
?>

I'm getting unexpected $ in line 116. Line 116 is?> to end the script.

[edited by: GordonEngquist at 5:07 pm (utc) on April 30, 2007]

jatar_k

6:15 pm on Apr 30, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



well, just pretend all the field stuff is still in this, just too long with all that too keep posting

but this throws no parse errors when I uploaded it to my server to test, it gives me lots of errors because the db doesn't exist but you should be able to sort that

/* Accessing SQL-server */
mysql_connect($server, $user, $_Password) or die ( "<H3>Server unreachable" . mysql_error() . "</H3>");
mysql_select_db($database) or die ( "<H3>Database non existent" . mysql_error() . "</H3>");

/* Entering the values */
$query = "INSERT INTO $table VALUES('','$FamLast', '$famphone', '$famlist', '$famaddy', '$famcity', '$famstate', '$famzip', '$hohfirst', '$hohmiddle', '$hohmaiden', '$hohdob', '$hohrelig', '$hohprac', '$hohbapt', '$hohcath', '$hohcomm', '$hohconf', '$hohpof', '$hohpofw', '$hohemp', '$hohtitle', '$hohgrade', '$hohemp', '$hohwkph', '$spfirst', '$spmiddle', '$spmaiden', '$spdob', '$sprelig', '$spprac', '$spbapt', '$spcath', '$spcomm', '$spconf', '$sppof', '$sppofw', '$spemp', '$sptitle', '$spgrade', '$spemp', '$spwkph', '$marstat', '$mardate', '$marcath', '$marnote', '$oth1name', '$oth1rel', '$oth1sex', '$oth1dob', '$oth1cathbap', '$oth1comm', '$oth1conf', '$oth1sch', '$oth1grd', '$oth2name', '$oth2rel', '$oth2sex', '$oth2dob', '$oth2cathbap', '$oth2comm', '$oth2conf', '$oth2sch', '$oth2grd', '$oth3name', '$oth3rel', '$oth3sex', '$oth3dob', '$oth3cathbap', '$oth3comm', '$oth3conf', '$oth3sch', '$oth3grd', '$oth4name', '$oth4rel', '$oth4sex', '$oth4dob', '$oth4cathbap', '$oth4comm', '$oth4conf', '$oth4sch', '$oth4grd', '$oth5name', '$oth5rel', '$oth5sex', '$oth5dob', '$oth5cathbap', '$oth5comm', '$oth5conf', '$oth5sch', '$oth5grd', '$opnation', '$opspneed', '$opsnhelp', '$ophandi', '$ophandhelp', '$opnote')";
mysql_query($query) or die ('<p>insert died: ' . mysql_error());

/* Display number of entries */
$query = 'select * from ' . $table;
$result = mysql_query($query) or die ('<p>select died: ' . mysql_error());
$number = mysql_num_rows($result);

if ($number <= 0){
echo "database empty";
} else {
echo "$number rows in database";
}

/* Close SQL-Connection */
mysql_close();
?>

usually if you get an error at the end of a script it is a missed {} or (), even sometimes a ;

brace being the most common

GordonEngquist

6:26 pm on Apr 30, 2007 (gmt 0)

10+ Year Member



I DANCE I DANCE I DANCE!

YOU ROCK!

My wife will love you for getting her husband back and away from this part LOL.

Now, I move on to the next step. Getting a page that thanks the user for their registration and gives them the option to go back to the home page. Any pointers?

jatar_k

6:45 pm on Apr 30, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



once you do all your error checking and make sure the insert actually worked then you can use header [php.net] to send them off to the thank you page.

something like this

header('Lacation: thankyou.html');

obviously you have to make sure that your pagename is in there and the path is right

the most common mistake with using header is you get a 'headers already sent' error. There can be no output before you use header, even a blank line at the beginning of the file before your <?php tag is considered output.

GordonEngquist

6:52 pm on Apr 30, 2007 (gmt 0)

10+ Year Member



Excellent, thank you for all your help. You really took a huge weight off of my shoulders. If there is any way to give you kudos here, let me know and it is done.

jatar_k

6:54 pm on Apr 30, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



my pleasure, just help someone else in the future and we're even