urldecode(0 and urlencode()
| From: | Anthony Ritter | Date: | Tue, 23 Apr 2002 20:05:41 +0000 |
| Subject: | urldecode(0 and urlencode() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-94239@lists.php.net to get a copy of this message | ||
In the following script, if the user types in Mike O'Hara in the name
textbox the final output is:
Mike O\'Hara
I am using the urlencode() and urldecode() functions.
If anybody can offer a suggestion how to lose the slash I would greatly
appreciate it.
Thanking all in advance.
Tony Ritter
.................................................
<HTML>
<BODY>
<FORM METHOD=get ACTION="parcel_det.php">
<B>What is your full name?</B><BR>
<INPUT TYPE="text" NAME="name" SIZE=20>
<BR> <BR>
<B>What is your email address?</B><BR>
<INPUT TYPE="text" NAME="email" SIZE=20>
<BR><BR>
<B>What is your telephone number?</B><BR>
<INPUT TYPE="text" NAME="phone" SIZE=20>
<BR><BR>
<B>What form of payment are you going to use?</B>
<SELECT NAME="payment">
<OPTION SELECTED>Visa
<OPTION>MasterCard
<OPTION>Amex
<OPTION>Invoice Me
</SELECT>
<INPUT TYPE="submit" VALUE="Submit">
<INPUT TYPE="reset" VALUE="Reset">
</FORM>
</BODY>
</HTML>
.............................
<HTML>
<BODY>
<FORM METHOD="get" ACTION="order_det.php">
<B>Type of Delivery Service </B><BR>
<SELECT NAME="postal">
<OPTION SELECTED>Gold Star
<OPTION>Silver Star
<OPTION>Bronze Star
</SELECT>
<BR><BR>
<B>What day should we collect your parcel?</B><BR>
<SELECT NAME="day">
<OPTION SELECTED>Monday
<OPTION>Tuesday
<OPTION>Wednesday
<OPTION>Thursday
<OPTION>Friday
</SELECT>
<BR><BR>
<B>How much does your parcel weigh?</B>
<SELECT NAME="weight">
<OPTION SELECTED>Less than 3 lb.
<OPTION>3 to 5 lbs.
<OPTION>5 to 8 lbs.
<OPTION>Over 8 lbs.
</SELECT>
<BR><BR>
<?
$name=(urlencode($name));
$email=(urlencode($email));
$phone=(urlencode($phone));
echo "<INPUT TYPE=\"hidden\" NAME=\"name\"
VALUE=\"$name\">";
echo "<INPUT TYPE=\"hidden\" NAME=\"email\"
VALUE=\"$email\">";
echo "<INPUT TYPE=\"hidden\" NAME=\"phone\"
VALUE=\"$phone\">";
echo "<INPUT TYPE=\"hidden\" NAME=\"payment\"
VALUE=\"$payment\">";
?>
<INPUT TYPE="submit" VALUE="Submit">
<INPUT TYPE="reset" VALUE="Reset">
</FORM>
</BODY>
</HTML>
............................
<HTML>
<BODY>
<TABLE BORDER=2 WIDTH=50% COLS=1>
<TR><TH>Here are your details</TH></TR>
<TR><TD>
<?
$name=(urldecode($name));
$email=(urldecode($email));
$phone=(urldecode($phone));
echo "Your name: <B>$name</B><BR>";
echo "Your email address: <B>$email</B><BR>";
echo "Your telephone number: <B>$phone</B><BR>";
echo "You are paying by: <B>$payment</B><BR>";
echo "Selected postal service is: <B>$postal</B><BR>";
echo "We collect your parcel on: <B>$day</B><BR>";
echo "The weight of your parcel is: <B>$weight</B>";
?>
</TD> </TR>
</TABLE>
</BODY>
</HTML>