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! 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>"; ?> 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; 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> 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. 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 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 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"; 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. 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. 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. 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
Archived
This topic is now archived and is closed to further replies.