A2xA Posted January 28, 2008 Share Posted January 28, 2008 my variable is: $dir my link is: /home/wiicharg/public_html/hubchat/Need variable here/shout.php; How would I put the variable there? thanks! Quote Link to comment https://forums.phpfreaks.com/topic/88125-solved-how-to-embed-variables-in-links/ Share on other sites More sharing options...
pocobueno1388 Posted January 28, 2008 Share Posted January 28, 2008 <?php echo "<a href='/home/wiicharg/public_html/hubchat/$dir/shout.php'>Link</a>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/88125-solved-how-to-embed-variables-in-links/#findComment-450884 Share on other sites More sharing options...
A2xA Posted January 28, 2008 Author Share Posted January 28, 2008 Would that still work if I copying() it? $newfile = /home/wiicharg/public_html/hubchat/$dir/shout.php; Quote Link to comment https://forums.phpfreaks.com/topic/88125-solved-how-to-embed-variables-in-links/#findComment-450885 Share on other sites More sharing options...
A2xA Posted January 28, 2008 Author Share Posted January 28, 2008 I still need help with this... it won't work. <html> <?php $dir = $_POST[dir]; $file = '/home/wiicharg/public_html/hubchat/hubex/shout.php'; $newfile = '/home/wiicharg/public_html/hubchat/***Need variable here***/shout.php'; if (!copy($file, $newfile)) { echo "failed to copy $file...\n"; } ?> </html> Quote Link to comment https://forums.phpfreaks.com/topic/88125-solved-how-to-embed-variables-in-links/#findComment-450894 Share on other sites More sharing options...
revraz Posted January 28, 2008 Share Posted January 28, 2008 You didn't read what he posted. You are using Single Quotes, you need to use Double Quotes around the string. Quote Link to comment https://forums.phpfreaks.com/topic/88125-solved-how-to-embed-variables-in-links/#findComment-450897 Share on other sites More sharing options...
A2xA Posted January 28, 2008 Author Share Posted January 28, 2008 I did, it still didn't work Quote Link to comment https://forums.phpfreaks.com/topic/88125-solved-how-to-embed-variables-in-links/#findComment-450901 Share on other sites More sharing options...
A2xA Posted January 28, 2008 Author Share Posted January 28, 2008 it's not the same thing. On his he's defining a link and on mine I'm defining a link within a variable. This is what happens when I post what he does: Parse error: syntax error, unexpected '<' in /home/wiicharg/public_html/hubchat/insert2.php on line 8 Quote Link to comment https://forums.phpfreaks.com/topic/88125-solved-how-to-embed-variables-in-links/#findComment-450904 Share on other sites More sharing options...
revraz Posted January 28, 2008 Share Posted January 28, 2008 $newfile = "/home/wiicharg/public_html/hubchat/$variable/shout.php"; Quote Link to comment https://forums.phpfreaks.com/topic/88125-solved-how-to-embed-variables-in-links/#findComment-450908 Share on other sites More sharing options...
A2xA Posted January 28, 2008 Author Share Posted January 28, 2008 oh, I guess you were right, thanks! I appreciate it . My bad. Quote Link to comment https://forums.phpfreaks.com/topic/88125-solved-how-to-embed-variables-in-links/#findComment-450911 Share on other sites More sharing options...
revraz Posted January 28, 2008 Share Posted January 28, 2008 Yep, some answers won't be cut and paste, but they will show you how to do something that you can modify a little and use. Quote Link to comment https://forums.phpfreaks.com/topic/88125-solved-how-to-embed-variables-in-links/#findComment-450912 Share on other sites More sharing options...
A2xA Posted January 28, 2008 Author Share Posted January 28, 2008 Well, I didn't just paste it I took out the a href and stuff out. I don't know what I did, but I was wrong and I got if fixed now! So I guess it dosen't matter. I really appreciate the help. Quote Link to comment https://forums.phpfreaks.com/topic/88125-solved-how-to-embed-variables-in-links/#findComment-450916 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.