parse area - printing variables in single quotes?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jarow
Forum Commoner
Posts: 83
Joined: Tue Jan 28, 2003 2:58 am

parse area - printing variables in single quotes?

Post by jarow »

I get the parse error: unexpected T_VARIABLE, expecting ',' or ';' when I try to run this code.

Code: Select all

<?php
echo str_repeat("<dd>",$i++).'<a href="$_REQUEST['user']._detail.php?user=$_REQUEST['user']"><font color="#003366"><i>';
?>
Any ideas on what is wrong?

thanks
[]InTeR[]
Forum Regular
Posts: 416
Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands

Post by []InTeR[] »

Try this: (not tested)

Code: Select all

<?php 
echo str_repeat("<dd>",$i++)."<a href="".$_REQUEST&#1111;'user']._detail.php?user=$_REQUEST&#1111;'user'].""><font color="#003366"><i>"; 
?>
jarow
Forum Commoner
Posts: 83
Joined: Tue Jan 28, 2003 2:58 am

Post by jarow »

Thanks

I get this error response with your suggestion:

Parse error: parse error, unexpected '=' in
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Start by reading this:
http://php.net/manual/en/language.types.string.php

Then try this:

Code: Select all

<?php 
echo str_repeat('<dd>', $i++).'<a href="'.$_REQUEST['user'].'_detail.php?user='.$_REQUEST['user'].'"><font color="#003366"><i>'; 
?>
Mac
Post Reply