doctorbill
asked on
php redirect
I have the following redirect url:
php redirect:
$redirect = "frm_artgallery.php?artist _added=".u rlencode($ _POST[art_ Nme]);
I need to add the following to it:
image_added=".urlencode($_ POST[art_t itle]
Can someone please help
php redirect:
$redirect = "frm_artgallery.php?artist
I need to add the following to it:
image_added=".urlencode($_
Can someone please help
You mean like this?
$redirect = "frm_artgallery.php?artist_added=".urlencode($_POST[art_Nme]) . "&image_added=" . urlencode($_POST[art_title]);
If this is going to be output in the browser then it should be escaped like so$redirect = "frm_artgallery.php?artist_added=".urlencode($_POST[art_Nme]) . "&image_added=" . urlencode($_POST[art_title]);
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
The url that is being presented with the code above is as follows:
frm_artgallery.php?artist_ added=new+ artist& ;image_add ed=title
This does not work
frm_artgallery.php?artist_
This does not work
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
If I add the %20 this works:
frm_artgallery.php?artist_ added=new+ artist%20& %20image_a dded=title
frm_artgallery.php?artist_
Have a look at the output from this script. I don't know what "this works" means, but it's good to know what the programming does to the data.
<?php
$str = urlencode(' ');
var_dump($str);
You might also want to consider whether the plus sign is doing what you want when it's used in the URL. Again, var_dump() is your friend!
ASKER
Ray:
Your code gives the following:
frm_artgallery.php?artist_ added=new+ artist&tit le
It is missing the &image_added=title and just using &title
Your code gives the following:
frm_artgallery.php?artist_
It is missing the &image_added=title and just using &title
ASKER
Sorry Ray - I have fixed it:
This works:
$redirect = $redirect
= 'frm_artgallery.php?'
. 'artist_added='
. urlencode($_POST['art_Nme' ])
. '&'. 'image_added='
. urlencode($_POST['art_titl e'])
;
This works:
$redirect = $redirect
= 'frm_artgallery.php?'
. 'artist_added='
. urlencode($_POST['art_Nme'
. '&'. 'image_added='
. urlencode($_POST['art_titl
;
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Absolutely - point take Ray
Solution as usual
Solution as usual
ASKER
Solution
Thanks for the points! ~Ray
$redirect = "frm_artgallery.php?artist