Jump to content

[SOLVED] Linking Problem


photodow

Recommended Posts

I am trying to write a php script, but I am having trouble with my links. I'm not sure what I'm doing wrong, so any help would be appreciated.

 

Here is the basic part of my script that I'm wanting it to do. The actual script is a tad more complicated, but not much. Just thought I would shorten it.

 

<?php

$week = date("W");

If ($week<"14") {
[<a href="#" onclick="window.open('year3/1_10.php', 'mywindow', 'width=500,height=350,resizable=no');"><font color=#808000>First Quarter</font></a>]
}

else {

<a href="#" onclick="window.open('year3/1_10.php', 'mywindow', 'width=500,height=350,resizable=no');"><font color=#808000>First Quarter</font></a>
}
?>

 

 

 

Again, thanks for any help you can provide!

Link to comment
https://forums.phpfreaks.com/topic/42190-solved-linking-problem/
Share on other sites

Alright looking back at my code I realized I didn't have the "echo". So I changed that, and got this.

 

<?php

$week = date("W");

If ($week<"14") {
echo "[<a href="#" onclick="window.open('year3/1_10.php', 'mywindow', 'width=500,height=350,resizable=no');"><font color=#808000>First Quarter</font></a>]";
}

else {

echo "<a href="#" onclick="window.open('year3/1_10.php', 'mywindow', 'width=500,height=350,resizable=no');"><font color=#808000>First Quarter</font></a>";
}
?>

 

But now there is another error saying:

 

Parse error: syntax error, unexpected '}', expecting ',' or ';' in /home/photodow/public_html/testarea.php on line 120

 

 

<?php
$week = date("W");

if ($week<"14") {
echo '[<a href="#" onclick="window.open(\'year3/1_10.php\', \'mywindow\', \'width=500,height=350,resizable=no\');"><font color=#808000>First Quarter</font></a>]';
}

else {

echo '<a href="#" onclick="window.open(\'year3/1_10.php\', \'mywindow\', \'width=500,height=350,resizable=no\');"><font color=#808000>First Quarter</font></a>' ;
}
?>

 

That is one way you can do it.

 

Another:

 

<?php
$week = date("W");

if ($week<"14"): ?>

[<a href="#" onclick="window.open('year3/1_10.php', 'mywindow', 'width=500,height=350,resizable=no');"><font color=#808000>First Quarter</font></a>]

<?php else: ?>
<a href="#" onclick="window.open('year3/1_10.php', 'mywindow', 'width=500,height=350,resizable=no');"><font color=#808000>First Quarter</font></a>
<?php endif;
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.