variable through url

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nikko50
Forum Commoner
Posts: 43
Joined: Thu Apr 08, 2004 6:28 am

variable through url

Post 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>";
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post by mudkicker »

try [php_man]urlencode[/php_man]()
nikko50
Forum Commoner
Posts: 43
Joined: Thu Apr 08, 2004 6:28 am

Post 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
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »


Example 1. urlencode() example

<?php
echo '<a href="mycgi?foo=', urlencode($userinput), '">';
?>
nikko50
Forum Commoner
Posts: 43
Joined: Thu Apr 08, 2004 6:28 am

Post 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)>";
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
Post Reply