I've inserted the following code
<?
if (isset($_GET['a']) {
$id = (int) $_GET['a'];
print "<a href='http://mydomain.net/?abc=$id'> here </a>";
}
else {
print "<a href='http://mydomain.net/?abc=0'>here</a>";
}
?>
but the explorer ignores this while what I see in firefox is
here "; } else { print " here ";
and only the second "here" has a link (=0).
What is my mistake?
a problem withpassing information in the URL
Moderator: General Moderators
Re: a problem withpassing information in the URL
You're missing a closing ) at the beginning of your if statement.
Code: Select all
if (isset($_GET['a'])) {
$id = (int) $_GET['a'];
echo "<a href='http://mydomain.net/?abc=$id'> here </a>";
} else {
echo "<a href='http://mydomain.net/?abc=0'>here</a>";
}
Re: a problem withpassing information in the URL
I've corrected my code and surprisingly got exactly the same results.
?!
?!
Re: a problem withpassing information in the URL
Try using full php tags..
Code: Select all
<?php
/*
*/
?>Re: a problem withpassing information in the URL
Didn't help (and that's reasonable as I work with bluehost)
Re: a problem withpassing information in the URL
Turn error_reporting() on.
View source to see exactly what the server gave you.
The code you pasted is not the code you use, maybe there's more to it? A quote is added, or missing?
View source to see exactly what the server gave you.
The code you pasted is not the code you use, maybe there's more to it? A quote is added, or missing?
Re: a problem withpassing information in the URL
When I viewed the source I saw that the following appears in purple
<?
if (isset($_GET['a']) {
$id = (int) $_GET['a'];
print "<a href='http://mydomain.net/?abc=$id'>
and the following was simply printed on the screen in my Firefox
here </a>";
}
else {
print "<a href='http://mydomain.net/?abc=0'>here</a>";
}
?>
so I got in my browser
here "; } else { print here } ?>
this code ( I checked it again) appears in the middle of a text sentence in my html file.
<?
if (isset($_GET['a']) {
$id = (int) $_GET['a'];
print "<a href='http://mydomain.net/?abc=$id'>
and the following was simply printed on the screen in my Firefox
here </a>";
}
else {
print "<a href='http://mydomain.net/?abc=0'>here</a>";
}
?>
so I got in my browser
here "; } else { print here } ?>
this code ( I checked it again) appears in the middle of a text sentence in my html file.
Re: a problem withpassing information in the URL
#1 get in the habbit of using full tags. (Short tags is removed/disabled by default in future versions of php)
#2 are you positive you have php installed? (Its hard for us to tell be cause you could simply have short tags disabled.)
#3 you have a syntax error, you need another ) after the isset function to close the if statement.
#2 are you positive you have php installed? (Its hard for us to tell be cause you could simply have short tags disabled.)
#3 you have a syntax error, you need another ) after the isset function to close the if statement.