Record insertion form problem

This is a discussion on "Record insertion form problem" within the PHP Forum section. This forum, and the thread "Record insertion form problem are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Feb 24th, 2006, 20:00
Junior Member
Join Date: Feb 2006
Age: 25
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Record insertion form problem

Because I am using aone page to display my whole site my record insertion form doesn't work!
If I do it from a normal name.php page the rcord insertion form works fine but becuase my page is called from inside this one page see my other post...
it doesn't work and this url comes up www.mysite.com/<?php%20echo%20/index.php?Section=Registration;%20?>
and when it worksfrom a stand alone page the url is www.mysite.com/registration?
Any ideas Web Wizards!
Please help out this frustrated newbie!
Cheers
Brain
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Feb 24th, 2006, 20:22
Reputable Member
Join Date: Sep 2005
Location: Canada, BC
Age: 24
Posts: 239
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Record insertion form problem

I will need to see your code to even begin to understand whats wrong, or what you are trying to do.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Feb 24th, 2006, 20:31
Junior Member
Join Date: Feb 2006
Age: 25
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Record insertion form problem

Thanks for replying Phoenix...

I am just using dreamweavers record insertion code e.g. see below
and the problem seems to be because i am calling all pages from one page like so but I don't know how to resolve this...

Just to reiterate it goes to the url

http://www.mysite.com/<?php%20echo%2...gistration;%20?> which doesn't bring up a page
<?php
function getCSS($x) {
if ($x == $_GET["Section"]) {
echo "activeButton";
} else {
echo "button";
}
}
?>

<td align="middle"><a class="<?php getCSS("")?>"href="index.php">Home</a></td>
<td align="middle" width="1"><span class="style22">&nbsp;|&nbsp; </span></td>
<td align="middle"><a class="<?php getCSS("Registration")?>" href="index.php?Section=Registration">Free Registration</a></td>

<?php
switch ($_GET["Section"]) {
case "Registration":




// Record insertion code

<?php require_once('Connections/The_DB.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO User_Details (Username, Password, `First Name`, Surname, Sex, Age, City, Country, Occupation, Unique_Description, Picture, ImageType, ShowAll, Email, PhoneNo, Contact_Access, Person1_FN, Person1_SN, Person2_FN, Person2_SN, Person3_FN, Person3_SN, Person4_FN, Person4_SN, Person5_FN, Person5_SN, Person6_FN, Person6_SN, Person7_FN, Person7_SN, Person8_FN, Person8_SN, Person9_FN, Person9_SN, Person10_FN, Person10_SN) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Username'], "text"),
GetSQLValueString($_POST['Password'], "text"),
GetSQLValueString($_POST['First_Name'], "text"),
GetSQLValueString($_POST['Surname'], "text"),
GetSQLValueString($_POST['Sex'], "text"),
GetSQLValueString($_POST['Age'], "text"),
GetSQLValueString($_POST['City'], "text"),
GetSQLValueString($_POST['Country'], "text"),
GetSQLValueString($_POST['Occupation'], "text"),
GetSQLValueString($_POST['Unique_Description'], "text"),
GetSQLValueString($_POST['Picture'], "text"),
GetSQLValueString($_POST['ImageType'], "text"),
GetSQLValueString($_POST['ShowAll'], "text"),
GetSQLValueString($_POST['Email'], "text"),
GetSQLValueString($_POST['PhoneNo'], "text"),
GetSQLValueString($_POST['Contact_Access'], "text"),
GetSQLValueString($_POST['Person1_FN'], "text"),
GetSQLValueString($_POST['Person1_SN'], "text"),
GetSQLValueString($_POST['Person2_FN'], "text"),
GetSQLValueString($_POST['Person2_SN'], "text"),
GetSQLValueString($_POST['Person3_FN'], "text"),
GetSQLValueString($_POST['Person3_SN'], "text"),
GetSQLValueString($_POST['Person4_FN'], "text"),
GetSQLValueString($_POST['Person4_SN'], "text"),
GetSQLValueString($_POST['Person5_FN'], "text"),
GetSQLValueString($_POST['Person5_SN'], "text"),
GetSQLValueString($_POST['Person6_FN'], "text"),
GetSQLValueString($_POST['Person6_SN'], "text"),
GetSQLValueString($_POST['Person7_FN'], "text"),
GetSQLValueString($_POST['Person7_SN'], "text"),
GetSQLValueString($_POST['Person8_FN'], "text"),
GetSQLValueString($_POST['Person8_SN'], "text"),
GetSQLValueString($_POST['Person9_FN'], "text"),
GetSQLValueString($_POST['Person9_SN'], "text"),
GetSQLValueString($_POST['Person10_FN'], "text"),
GetSQLValueString($_POST['Person10_SN'], "text"));
mysql_select_db($database_The_DB, $The_DB);
$Result1 = mysql_query($insertSQL, $The_DB) or die(mysql_error());
$insertGoTo = "/NewUserConfirm.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>

Many thanks mate.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Feb 27th, 2006, 01:00
Reputable Member
Join Date: Sep 2005
Location: Canada, BC
Age: 24
Posts: 239
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Record insertion form problem

Er...

I don't see your url in the code anywhere... am I to be under the impression that you are inserting the php into the webbrowsers address bar?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
record, insertion, form, problem

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Form creating record but not adding data Andrew1986 Databases 22 Oct 19th, 2007 08:47
E-mailing a report based on current record on form easydoesit Databases 0 Aug 27th, 2007 23:07
Add/Delete/Modify Database Record form David Blake Starting Out 6 May 1st, 2007 16:22
record set problem of sorts... riotman Classic ASP 3 Jan 20th, 2006 23:32
Delete record problem Gee Bee Databases 2 Jan 4th, 2006 18:28


All times are GMT. The time now is 21:05.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42