Re: [PHP-DB] Updating Forms Values

2002-04-04 Thread Paul Burney

on 4/4/02 8:35 AM, [EMAIL PROTECTED] at [EMAIL PROTECTED] appended the following
bits to my mbox:

 home.php?name=Barry Zimmerman
 
 This once you have eddited a page becomes:
 
 home.php?name=Barry

You'll need to url encode the variable:

echo 'home.php?name=' , urlencode($username);

HTH.

Sincerely,

Paul Burney
http://paulburney.com/

?php
while ($self != asleep) {
$sheep_count++;
}
?



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Re: [PHP-DB] Updating Forms Values

2002-04-04 Thread Bzdpltd

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 = PWelcome 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
TITLEedited/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=#ffCENTER
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=2IMG 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
TDIMG SRC=../../Resources/admintitle.gif BORDER=0
WIDTH=209 HEIGHT=17 ALT=/TD
TD HEIGHT=17/TD
/TR
TR
TD WIDTH=90IMG SRC=../../Resources/_clear.gif BORDER=0
WIDTH=90 HEIGHT=1 ALT=/TD
TD WIDTH=12IMG SRC=../../Resources/_clear.gif BORDER=0
WIDTH=12 HEIGHT=1 ALT=/TD
TD WIDTH=209IMG SRC=../../Resources/_clear.gif BORDER=0
WIDTH=209 HEIGHT=1 ALT=/TD
TD WIDTH=1 HEIGHT=1IMG 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=RIGHTFONT FACE=Verdana, Arial
SIZE=2SPAN CLASS=style3| /SPAN/FONTA
HREF=../index.php?name=? echo urlencode($name); ?FONT
FACE=Verdana, Arial SIZE=2SPAN CLASS=style3back to my
clients/SPAN/FONT/AFONT FACE=Verdana, Arial SIZE=2SPAN
CLASS=style3 | /SPAN/FONTA HREF=../../index.php 
TARGET=_selfFONT FACE=Verdana, Arial SIZE=2SPAN
CLASS=style3log out/SPAN/FONT/AFONT FACE=Verdana, Arial
SIZE=2SPAN 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=312IMG SRC=../../Resources/_clear.gif BORDER=0
WIDTH=312 HEIGHT=1 ALT=/TD
TD WIDTH=8IMG SRC=../../Resources/_clear.gif BORDER=0 WIDTH=8
HEIGHT=1 ALT=/TD
TD WIDTH=371IMG SRC=../../Resources/_clear.gif BORDER=0
WIDTH=371 HEIGHT=1 ALT=/TD
TD WIDTH=2 HEIGHT=1IMG 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=CENTERFONT FACE=\Verdana\SPAN