Lee-Bartlett Posted October 23, 2008 Share Posted October 23, 2008 This is my code so far, i was woundering how i could add a varible to this small piece of code, say i named a varible images, so it went to google.com/images. <?php echo "<form>"; echo "<td><INPUT type=\"button\" value=\"New Window!\" onClick=\"window.open('http://www.google.com','mywindow','width=600,height=400,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes')\">"; echo "</td></tr>"; echo "</form>"; ?> Link to comment https://forums.phpfreaks.com/topic/129854-how-would-i-add-varibles-to-a-url/ Share on other sites More sharing options...
Alt_F4 Posted October 23, 2008 Share Posted October 23, 2008 decalre a variable $variable = "/images"; and append it to the url like so: 'http://www.google.com".$variable."' that should do the trick Link to comment https://forums.phpfreaks.com/topic/129854-how-would-i-add-varibles-to-a-url/#findComment-673196 Share on other sites More sharing options...
hamza Posted October 24, 2008 Share Posted October 24, 2008 YOUR ANSWER IS "QUERY STRING" SYNTAX URL ? VAR=VALUE & Explanation after url ? sign indicate that you are going to use variable and values VAR mean variable value mean yoru value of the variable & sign show that you need to declare another variable and value like this below http://www.google.com?name=abc&name=abc EXAMPLE http://www.google.com?name=abc and improved form of first reply from other guy echo 'http://www.google.com".$variable."'; Link to comment https://forums.phpfreaks.com/topic/129854-how-would-i-add-varibles-to-a-url/#findComment-673356 Share on other sites More sharing options...
Alt_F4 Posted October 24, 2008 Share Posted October 24, 2008 true except that the OP wanted to alter the URL from google.com to google.com/images. AFAIK you cant do this with a query string Link to comment https://forums.phpfreaks.com/topic/129854-how-would-i-add-varibles-to-a-url/#findComment-673366 Share on other sites More sharing options...
redarrow Posted October 24, 2008 Share Posted October 24, 2008 Is here any point in this quistion what u want to acheve mate........ Link to comment https://forums.phpfreaks.com/topic/129854-how-would-i-add-varibles-to-a-url/#findComment-673378 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.