Hi there again. I have tried using the urlencode method but for some reason it is still doing the same thing and stripping the rest of the name.
I will try to explain more how this works. I have a site where you login using a name and passord. These values are stored using cookies and we have the cookie script on each page before the headers to check to see if the user is allowed at the page there are trying to access. This is working fine until we come to editing or adding records. What happens is the name is tagged onto the standard url links on each page. So therefore knowing what records to show according to which user is logged into the system. Now I have tried using the urlencode but for some reason it just does not seem to work. Basically when the user of the system adds or edits a new record, once they click submit and are taken to the next page which either updates or adds the new entry, the links which takes them back to the start of the system loses the end of there name as there is a a space between there first and second name. I have pasted the code which updates the record in the database, together with some of the other code on the page. The cookie is at the top and if you look at the link to go back to the index it contains a urlencode there. I hope someone can help as I am pulling my hair on this one. Many thanks Barry ***************** <? if ($name == "$name") { $msg = "<P>Welcome to secret page A, authorized user!</p>"; } else { header("Location: http://*****/administration/error.php"); exit; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>edited</TITLE> <META NAME="GENERATOR" CONTENT="Freeway 3.1"> <STYLE TYPE="text/css"> <!-- style6 { margin-top: 0px; } style3 { font-size: 10px; } --> </STYLE> </HEAD> <BODY TOPMARGIN=0 LEFTMARGIN=0 MARGINHEIGHT=0 MARGINWIDTH=0 BGCOLOR="#ffffff"><CENTER> <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=693> <TR VALIGN=TOP> <TD COLSPAN=3></TD> <TD HEIGHT=8></TD> </TR> <TR VALIGN=TOP> <TD ROWSPAN=3> <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=312> <TR VALIGN=TOP> <TD ROWSPAN=2><IMG SRC="../../Resources/ip20tm.gif" BORDER=0 WIDTH=90 HEIGHT=39 ALT=""></TD> <TD COLSPAN=2></TD> <TD HEIGHT=22></TD> </TR> <TR VALIGN=TOP> <TD></TD> <TD><IMG SRC="../../Resources/admintitle.gif" BORDER=0 WIDTH=209 HEIGHT=17 ALT=""></TD> <TD HEIGHT=17></TD> </TR> <TR> <TD WIDTH=90><IMG SRC="../../Resources/_clear.gif" BORDER=0 WIDTH=90 HEIGHT=1 ALT=""></TD> <TD WIDTH=12><IMG SRC="../../Resources/_clear.gif" BORDER=0 WIDTH=12 HEIGHT=1 ALT=""></TD> <TD WIDTH=209><IMG SRC="../../Resources/_clear.gif" BORDER=0 WIDTH=209 HEIGHT=1 ALT=""></TD> <TD WIDTH=1 HEIGHT=1><IMG SRC="../../Resources/_clear.gif" BORDER=0 WIDTH=1 HEIGHT=1 ALT=""></TD> </TR> </TABLE> </TD> <TD COLSPAN=2></TD> <TD HEIGHT=26></TD> </TR> <TR VALIGN=TOP> <TD></TD> <TD> <P CLASS="style6" ALIGN=RIGHT><FONT FACE="Verdana, Arial" SIZE=2><SPAN CLASS="style3">| </SPAN></FONT><A HREF="../index.php?name=<? echo urlencode($name); ?>"><FONT FACE="Verdana, Arial" SIZE=2><SPAN CLASS="style3">back to my clients</SPAN></FONT></A><FONT FACE="Verdana, Arial" SIZE=2><SPAN CLASS="style3"> | </SPAN></FONT><A HREF="../../index.php" TARGET="_self"><FONT FACE="Verdana, Arial" SIZE=2><SPAN CLASS="style3">log out</SPAN></FONT></A><FONT FACE="Verdana, Arial" SIZE=2><SPAN CLASS="style3"> |</SPAN></FONT></P></TD> <TD HEIGHT=13></TD> </TR> <TR VALIGN=TOP> <TD COLSPAN=2></TD> <TD HEIGHT=1></TD> </TR> <TR> <TD WIDTH=312><IMG SRC="../../Resources/_clear.gif" BORDER=0 WIDTH=312 HEIGHT=1 ALT=""></TD> <TD WIDTH=8><IMG SRC="../../Resources/_clear.gif" BORDER=0 WIDTH=8 HEIGHT=1 ALT=""></TD> <TD WIDTH=371><IMG SRC="../../Resources/_clear.gif" BORDER=0 WIDTH=371 HEIGHT=1 ALT=""></TD> <TD WIDTH=2 HEIGHT=1><IMG SRC="../../Resources/_clear.gif" BORDER=0 WIDTH=2 HEIGHT=1 ALT=""></TD> </TR> </TABLE> <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=693> <TR VALIGN=TOP> <TD></TD> <TD HEIGHT=6></TD> </TR> <TR VALIGN=TOP> <TD><?php // create connection $connection = mysql_connect("*****","*****","*****") or die("Couldn't make connection."); // select database $db = mysql_select_db("*****", $connection) or die("Couldn't select database."); ?> <? if ($REQUEST_METHOD=="POST") { # setup SQL statement $SQL = " UPDATE case_study SET"; $SQL = $SQL . " clientname = '$clientname', "; $SQL = $SQL . " activity = '$activity', "; $SQL = $SQL . " title = '$title', "; $SQL = $SQL . " brief = '$brief', "; $SQL = $SQL . " solution = '$solution', "; $SQL = $SQL . " result = '$result' "; $SQL = $SQL . " WHERE id = '$id' "; #execute SQL statement $result = mysql_db_query( inpress,"$SQL",$connection ); # check for error if (!$result) { echo("ERROR: " . mysql_error() . "\n$SQL\n"); } echo ("<P ALIGN=CENTER><FONT FACE=\"Verdana\"><SPAN CLASS=\"style3\"><B>Case Study Updated.</FONT></SPAN></B></P>\n"); } echo ("<input type=hidden name=name value=\"$name\">"); echo ("<input type=hidden name=clientname value=$clientname>"); echo ("<input type=hidden name=id value=$id>"); ?></TD> <TD HEIGHT=290></TD> </TR> <TR> <TD WIDTH=684><IMG SRC="../../Resources/_clear.gif" BORDER=0 WIDTH=684 HEIGHT=1 ALT=""></TD> <TD WIDTH=9 HEIGHT=1><IMG SRC="../../Resources/_clear.gif" BORDER=0 WIDTH=9 HEIGHT=1 ALT=""></TD> </TR> </TABLE> </CENTER> </BODY> </HTML> **************** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php