Hi, I need to work out the problem with this script, please help me:
<html> <head>Adfly Links</head> <body> <?php $x = 0 $x= $x + 1 echo "<a href=\$x . ".html">Follow Me</a>"; ?> <a href="\"<?php echo $x ; ?>".html"><?php echo $x; ?></a><br> <? php $x = $x + 1; ?> <a href="\<?php echo $x; ?> .html"><?php echo $x; ?></a><br> <? php $x = $x + 1; ?> <a href="\<?php echo $x; ?> .html"><?php echo $x; ?></a><br> <? php $x = $x + 1; ?> <a href="\<?php echo $x; ?> .html"><?php echo $x; ?></a><br> <? php $x = $x + 1; ?> </body> </html>
(It's a project I'm working on in free time)
Offline
New code:
<html> <head></head> <body> <?php $_SESSION['x'] = '0'; $_SESSION['x'] = 'x + 1'; ?> <a href="\ <?php echo $SESSION['x'] ; ?>.html"><?php echo $x; ?></a><br> <? php $x = $x + 1; ?> <a href="\<?php echo $x; ?>.html"><?php echo $x; ?></a><br> </body> </html>
Offline
Like this?
<html> <head></head> <body> <?php $x = 0; $x++; ?> <a href="<?php echo $x; ?>.html"><?php echo $x; ?></a><br> <?php $x = $x + 1; ?> <a href="<?php echo $x; ?>.html"><?php echo $x; ?></a><br> </body> </html>
Offline
<?php $x = 0; $page = '<html> <head><title>Adfly Links</title></head> <body>'; while ($x < 3) { $page .= '<a href="'.$x.'.html">'.$x.'</a><br />'; $x++; } $page .= '</body> </html>'; echo $page; ?>
I really dislike switching between PHP and HTML like what you've done. ( <html><?php ?></html> ) It's really messy.
Offline
Magnie wrote:
Code:
<?php $x = 0; $page = '<html> <head><title>Adfly Links</title></head> <body>'; while ($x < 3) { $page .= '<a href="'.$x.'.html">'.$x.'</a><br />'; $x++; } $page .= '</body> </html>'; echo $page; ?>I really dislike switching between PHP and HTML like what you've done. ( <html><?php ?></html> ) It's really messy.
I think it's fine like that. As Sparks said, it gives syntax highlighting.
Offline
Magnie wrote:
Code:
<?php $x = 0; $page = '<html> <head><title>Adfly Links</title></head> <body>'; while ($x < 3) { $page .= '<a href="'.$x.'.html">'.$x.'</a><br />'; $x++; } $page .= '</body> </html>'; echo $page; ?>I really dislike switching between PHP and HTML like what you've done. ( <html><?php ?></html> ) It's really messy.
I prefer to switch between html and php because you can code html as normal without worrying about double quotes and stuff.
Offline
Daffy&Sci: Well, it's hard to read the PHP then. Which could result in errors.
Offline
Magnie wrote:
Daffy&Sci: Well, it's hard to read the PHP then. Which could result in errors.
Well, each to his own.
Offline
Magnie wrote:
Code:
<?php $x = 0; $page = '<html> <head><title>Adfly Links</title></head> <body>'; while ($x < 3) { $page .= '<a href="'.$x.'.html">'.$x.'</a><br />'; $x++; } $page .= '</body> </html>'; echo $page; ?>I really dislike switching between PHP and HTML like what you've done. ( <html><?php ?></html> ) It's really messy.
Thank you - this is what I was looking for.
Offline