Page 1 of 1

passign URL variables

Posted: Wed Jan 14, 2009 5:42 pm
by bdee1
i am having some trouble buildign links that have url variables.

i am trying to build a link that looks like this:

Code: Select all

<a href="deleteItem.php?id=7">X</a>
i am using the following code:

Code: Select all

 
echo("<a href='deleteItem.php?id=".$id."'>X</a>")
 
but the browser renders the link as:

Code: Select all

 
<a href='deleteItem~id~4.php'>X</a>
 
what am i doing wrong??

Re: passign URL variables

Posted: Wed Jan 14, 2009 6:26 pm
by it2051229
I did a test but it rendered it correctly. Give more codes

Re: passign URL variables

Posted: Wed Jan 14, 2009 6:47 pm
by bdee1
it2051229 wrote:I did a test but it rendered it correctly. Give more codes
Is there some kind of php.ini setting that would cause this ?
What other code can I supply?

Re: passign URL variables

Posted: Wed Jan 14, 2009 7:08 pm
by califdon
You're saying that the browser address bar shows precisely: <a href='deleteItem~id~4.php'>X</a> ? My first guess is that it's a browser issue. Try viewing with another browser. You're saying that the .php? doesn't even come through?! I've never heard of something like that happening.

Re: passign URL variables

Posted: Wed Jan 14, 2009 7:23 pm
by bdee1
yes thats exactly what is happening... i have tried it in ie7, ie8 and firefox. same result.


test for yourself at http://www.blairdee.info/php

the links i am referring to are the X links next to each item.

Re: passign URL variables

Posted: Wed Jan 14, 2009 7:45 pm
by califdon
Well, you're right, that's what's in the source code. So in order to offer you any help, you'll need to supply the surrounding PHP code that is creating the links. More than just the one line. Obviously, the variable that you THINK contains just the ID must contain some other characters; the issue is where it's coming from.

Re: passign URL variables

Posted: Wed Jan 14, 2009 7:59 pm
by bdee1
califdon wrote:Well, you're right, that's what's in the source code. So in order to offer you any help, you'll need to supply the surrounding PHP code that is creating the links. More than just the one line. Obviously, the variable that you THINK contains just the ID must contain some other characters; the issue is where it's coming from.
ok gotcha... well heres the complete source code...

Code: Select all

 
<?php
#PARSING THE XML FILE USING SIMPLEXML... for mor info google "SimpleXML"
 
#CREATING THE HANDLER
#
$xml = simplexml_load_file('file.xml');
 
#
#LOOP THROUGH  THE <LINKGROUP> NODES
#
foreach($xml->linkGroup as $linkGroup)
{
    $linkGroupTitle = $linkGroup['id']; 
    echo("<strong>Link Group: " . $linkGroupTitle . "</strong><br/>");
    
    #
    #REMOVE THE FIRST <linkItem> NODE
    #
    #unset($linkGroup->linkItem[0]);
    
        
    echo("<ul>");
    
    #
    #LOOP THROUGH  THE <LINKITEM> NODES (CHILD OF <LINKGROUP>
    #
    foreach($linkGroup->linkItem as $linkItem)
    {
        $id = $linkItem['id'];
        $title = $linkItem->title;
        $url = $linkItem->url;
        $description = $linkItem->description;
        ?>
            <li>
                (ID <?php echo($id)?>)<?php echo($title)?><br>
                <?php echo($description)?><br>
                <a href="<?php echo($url)?>"><?php echo($url)?></a>
                 [<a href="deleteItem.php?id=<?php echo($id)?>">X</a>]<br><br>
            </li>
        <?php
        
        #echo("<li>".$id.": ".$title.": ".$url." [<a href='deleteItem.php?id=".$id."'>X</a>]</li>");
    }
    echo("</ul>");
}
 
?>
<br>
<a href="addItem.php">Add another link</a>
 
 
and here is the xml file:

Code: Select all

 
<?xml version="1.0" encoding="utf-8"?>
<linkCollection>
    <linkGroup id="Photoshop">
        <linkItem id="1">
            <title>Google</title>
            <description>This is the first link</description>
            <url>www.google.com</url>
        </linkItem>
        <linkItem id="2">
            <title>blairdee.info</title>
            <description>This is the second link</description>
            <url>www.blairdee.info</url>
        </linkItem>
        <linkItem id="3">
            <title>Microsoft Windows 7 Website</title>
            <description>This is the third link</description>
            <url>www.microsoft.com/windows7</url>
        </linkItem>
        <linkItem id="4">
            <title>Fandango</title>
            <description>This is the fourth Link</description>
            <url>www.fandango.com</url>
        </linkItem>
    </linkGroup>
</linkCollection>
 
 

Re: passign URL variables

Posted: Thu Jan 15, 2009 8:31 am
by bdee1
ok so heres something interestign, i emailed the two files to a buddy who is running wamp on his local machine and he ran them and it worked just fine. so it HAS to be some kind of setting with my php install... what could it be??

Re: passign URL variables

Posted: Thu Jan 15, 2009 9:51 am
by bdee1
ok problem solved... turns out i had an old IIS plugin called LinkFreeze which was some kind of url renaming tool. i uninstalled it and its fixed.