mcfmullen Posted June 20, 2010 Share Posted June 20, 2010 I spent the entire day trying to figure this out and I'm about to give up. FYI, I use wordpress hence some wordpress calls. The bloginfo('url'); simply refers to my domain url (I.e. www.cool.com/). URL path example: http://www.cool.com/TEST/wp-content/themes/arjuna-x/itemspec2.php?item=Heart&type=Recovery Here is the code I have in my index.php file: <?php include("variables.php"); ?> <a href="<?php bloginfo('url'); echo $url.$item; ?>&type=<?php echo $table; ?>" title="<?php _e('Permalink to', 'Arjuna'); ?><?php echo $item; ?>"><?php echo $item; ?></a> and this is inside my variables.php file: <?php $table = $_GET['type']; $item = $_GET['item']; $url='/wp-content/themes/arjuna-x/itemspec2.php?item='; ?> The two files work together just fine but for the sake of simplicity, what I want to do is create a single variable (ideally $url) which will contain the whole of the code given from index.php but everthing I try results in errors. In essence, I need someone to help me correct this code: <?php $url = <a href="<?php bloginfo('url'); ?>/wp-content/themes/arjuna-x/itemspec2.php?item=.$item; ?>&type=<?php echo $table; ?>" title="<?php _e('Permalink to', 'Arjuna'); ?><?php echo $item; ?>"><?php echo $item; ?></a> ?> which will be stored in variables.php so that my code in index.php will show as follows: <?php include("variables.php"); ?> <?php $url; ?> Link to comment https://forums.phpfreaks.com/topic/205358-passing-href-through-php-variable/ Share on other sites More sharing options...
mcfmullen Posted June 20, 2010 Author Share Posted June 20, 2010 While we're at it, I also have this code: $sql = "SELECT * FROM (.$table LEFT JOIN animalThemes2 USING (Name)) LEFT JOIN animalMethods2 USING (Name) WHERE .$table.Name = '{$item}'"; where I want animalThemes2 and animalMethods2 to resemble something like .$tableThemes2 and .$tableMethods2 if at all possible. (I.E. $table contains animal) Link to comment https://forums.phpfreaks.com/topic/205358-passing-href-through-php-variable/#findComment-1074745 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.