Nightmareinhell Posted January 5, 2011 Share Posted January 5, 2011 Hello! I was wondering if this could be done... I want to take a variable, and insert it into a URL for a $_GET on a different page? Basically Its a member website, and I want the admin to be able to "accept" or "deny" the application... So i have a page that displays all the applications, and I want it to take him to a different page with all the user's information in detail. Right now it only displays their name, but when the admin presses the link, it takes them to a more detailed page about the applicant, where they can then "accept" or "deny" the application.... Here is what i got so far... $character_name = "Nightmareinhell"; <a href="admin_evaluate.php?name=$character_name">$character_name</a> Here is the error I get from the code above Parse error: syntax error, unexpected T_STRING in C:\wamp\www\admin_acceptapply.php Thanks to any help!!!! Link to comment https://forums.phpfreaks.com/topic/223435-insert-a-variable-into-a-url-for-_get-later/ Share on other sites More sharing options...
Pikachu2000 Posted January 5, 2011 Share Posted January 5, 2011 You're just throwing a string in there (<a href="admin_evaluate.php?name=$character_name">$character_name</a>) after you assign the value to $character_name. That's why you're getting the error. What are you trying to do with that string? Echo it? Link to comment https://forums.phpfreaks.com/topic/223435-insert-a-variable-into-a-url-for-_get-later/#findComment-1155009 Share on other sites More sharing options...
Nightmareinhell Posted January 5, 2011 Author Share Posted January 5, 2011 Sorry I did not put enough information down Yes, Its in a loop that displays all the application names (for the purpose of this post.. i just threw in $character_name = "Nightmareinhell";, it really gets its value from a database) But... Here is more of my code i guess you could say... $character_name = "Nightmareinhell" $name = "<tr> <td><a href="admin_evaluate.php?name=$character_name">$character_name</a></td> </tr>"; echo $name; I want it to where when you click on that link, I'm able to grab name by using: $character_name = $_GET['name']; Thanks!! Link to comment https://forums.phpfreaks.com/topic/223435-insert-a-variable-into-a-url-for-_get-later/#findComment-1155011 Share on other sites More sharing options...
Pikachu2000 Posted January 5, 2011 Share Posted January 5, 2011 You're trying to use unescaped double quotes within a double quoted string. When using quotes of the same type that enclose the string, they need to be escaped with backslashes as below. $character_name = "Nightmareinhell" $name = "<tr> <td><a href=\"admin_evaluate.php?name=$character_name\">$character_name</a></td> </tr>"; echo $name; Link to comment https://forums.phpfreaks.com/topic/223435-insert-a-variable-into-a-url-for-_get-later/#findComment-1155015 Share on other sites More sharing options...
Nightmareinhell Posted January 5, 2011 Author Share Posted January 5, 2011 Thank You!!!! Thank You Thank You Thank You!! Worked perfectly!! Link to comment https://forums.phpfreaks.com/topic/223435-insert-a-variable-into-a-url-for-_get-later/#findComment-1155017 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.