mvhemanth 03-06-2007, 12:48 PM Problem in IE, wanted solution
Path:
localhost/articles/
<?php
$self = $_SERVER['PHP_SELF'];
$pg_content = "<a href=\"$self?id=$id\">$article_title</a>";
?>
this link works fine in Firefox by querying the db and displaying the article details
in IE6 it keeps coming back to the index even though
the proper url is passed to the IE address bar as
http://localhost/articles/index.php?id=1
if the above url is manually entered into the address bar it works fine
anyone know why ?
mvhemanth 03-06-2007, 01:13 PM <a href="http://a/va2/index.php?id=1">http://a/va2/index.php?id=1</a><br>
<a href="/a/va2/index.php?id=1">/a/va2/index.php?id=1</a><br>
<a href="a/va2/index.php?id=1">a/va2/index.php?id=1</a><br>
<a href="index.php?id=1">index.php?id=1</a><br>
even these
first & last work in firefox
none work in internet explorer
Nightfire 03-06-2007, 01:17 PM Code you're using to get the $id info from the url is?
mvhemanth 03-06-2007, 01:29 PM snippet
$pg_content .= "<a href=\"$self?id=$id \">$article_title</a>";
it is working perfectly in Firefox
Nightfire 03-06-2007, 01:31 PM Yeah that's gonna put it in the link, but what are you using to get it from the url?
Are you using $_GET['id']?
mvhemanth 03-06-2007, 01:33 PM at least these manually entered <a> links
should work
they are not
but if you type these exactly into the address bar they work
not as a link on the page
links to other pages (separate page to handle get/post data)
also work
Nightfire 03-06-2007, 01:35 PM I'll ask one more time. Show the code you are using to retrieve id from the url. You're just showing a link. A link isn't what I'm asking for. There's an error in your code, or you have a caching problem in IE. But I do not know what it is as I have no code to work from, therefore I cannot help you
mvhemanth 03-06-2007, 01:44 PM if(!isset($_GET['id']))
{ // if no id is specified, show the list
$self = $_SERVER['PHP_SELF'];
$query = "SELECT ad_id, ad_time, ad_title, ad_content FROM va_ads ORDER BY ad_id";
$result = mysql_query($query) or die('Error : ' . mysql_error());
$pg_title = 'Latest Ads List';
// create the list
$pg_content = "<table width=100% cellspacing=0 cellpadding=5 border=1 valign=top>
<tr><th>Select for details<th>Date</tr>" ;
while($row = mysql_fetch_array($result, MYSQL_NUM))
{
list($ad_id, $ad_time, $ad_title, $ad_content) = $row;
$pg_content .= "<tr><td><a href=\"$self?id=$ad_id \">$ad_title</a><br>
$ad_content</td><td width=50>" . date('M j Y', strtotime($ad_time)) . "</td></tr>";
}
$pg_content .= '</table>' ;
} else {
// id selected so get the article info from database
$query = "SELECT ad_id, ad_time, ad_title, ad_content FROM va_ads WHERE ad_id=".$_GET['id'];
$result = mysql_query($query) or die('Error : ' . mysql_error());
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$pg_title = $row['ad_title'];
$pg_content = '<p><b>Date : </b>'.date('M j Y', strtotime($row['ad_time'])).
'<p><b>Advertisement Details :</b><br>'.$row['ad_content'];
this is the unaltered code which is working in firefox
sorry for delay. quick reply was getting stuck
JohnDubya 03-06-2007, 02:40 PM I'm not sure if I'm seeing everything, but I don't see where you set $id to be anything. It should be set like:
$id = $_GET['id'];
mvhemanth 03-06-2007, 03:01 PM [QUOTE=mvhemanth;541808]
if(!isset($_GET['id']))
{ // the if not set code
} else {
// the id is set
$query = "SELECT ad_id, ad_time, ad_title, ad_content FROM va_ads
WHERE ad_id=".$_GET['id'];
^^^^^^^^^^^^^^
$result = mysql_query($query) or die('Error : ' . mysql_error());
*******************
I'm querying the DB with the ID
I again repeat... "works perfectly in Firefox"
i'm beginning to thing self referencing with GET/POST doesnt work in IE
buy if u type...
localhost/va2/index.php?id=1
MANUALLY in the address bar it works in IE
if you use it as a 'self referencing' link
<a href="index.php?id=1">List</a>
within the 'index.php' file
^^^^^^^^
it is not working only in IE
even as a simple link
link on page not working
manual entry in address bar working
JohnDubya 03-06-2007, 03:11 PM Well, you're getting the $_GET['id'] for the query, but in your link:
$pg_content = "<a href=\"$self?id=$id\">$article_title</a>";
You are using $id, which hasn't even been set in your code. That's why the variable isn't showing up. If you use the little snippet I used up above, that will insert the $_GET['id'] into the $id variable. Good luck.
mvhemanth 03-06-2007, 03:24 PM Well, you're getting the $_GET['id'] for the query, but in your link:
$pg_content = "<a href=\"$self?id=$id\">$article_title</a>";
You are using $id, which hasn't even been set in your code. That's why the variable isn't showing up. If you use the little snippet I used up above, that will insert the $_GET['id'] into the $id variable. Good luck.
I am using $self?id=$ad_id
as i have posted in the detailed code u asked for
its still not working
aedrin 03-06-2007, 03:54 PM First, I'd suggest escaping your variables when echoing it.
$link = "<a href=\"{$self}?id={$ad_id}\">Link</a>";
You never know what is happening to $ad_id when it is trying to read it.
Now, on the actual page in Internet Explorer, right click the link and choose Copy Shortcut. Paste that into here so we know what link it is generating.
In index.php, before the check for $_GET['id'], put this:
print_r($_GET);
Copy the results of that and paste it into here.
|
|