Page 1 of 1

variable through url

Posted: Mon Oct 11, 2004 12:51 pm
by nikko50
twigletmac | Help us, help you. Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Hello all. Why in the below code does the $message variable only echo the first word "this" on the next page ?? All the rest are chopped off when passing this variable through the url.

Code: Select all

$message="this is a test.";
echo "<meta http-equiv=refresh content=0;url=Admin.php?message=$message>";

Posted: Mon Oct 11, 2004 1:05 pm
by mudkicker
try [php_man]urlencode[/php_man]()

Posted: Mon Oct 11, 2004 1:22 pm
by nikko50
OK. Still not working. What am I doing wrong:(

echo "<meta http-equiv=refresh content=0;url=emailAdmin.php?message=',urlencode($message),'>";


Tracy

Posted: Mon Oct 11, 2004 1:29 pm
by John Cartwright

Example 1. urlencode() example

<?php
echo '<a href="mycgi?foo=', urlencode($userinput), '">';
?>

Posted: Mon Oct 11, 2004 4:23 pm
by nikko50
I'm sorry but I must be stupid or something. I can't get this to work.Here's what I have so far but the variable will not pass. Please help.
Tracy

echo "<meta http-equiv=refresh content=0;url=emailAdmin.php?message=urlencode($message)>";

Posted: Mon Oct 11, 2004 4:27 pm
by John Cartwright

Code: Select all

<?
echo "<meta http-equiv=refresh content=0;url=emailAdmin.php?message=',urlencode($message),'>";
?>


Did you fail to see my example?

Posted: Tue Oct 12, 2004 4:52 am
by twigletmac
Try using quotes on the meta tag's attribute too:

Code: Select all

echo '<meta http-equiv="refresh" content="0;url=emailAdmin.php?message=',urlencode($message),'">';
Mac