ajoo Posted January 11, 2014 Share Posted January 11, 2014 Hi, I am stuck trying to get the link/href statement to work. I have tried so many variations but i get a very persistent error. Kindly help while($rows=mysqli_fetch_array($result)) { $count = $count+1; $field[$count] = $rows['Member_ID']; echo "<tr> <td>".$count."</td> <td>   ".$rows['fname'].' '.$rows['lname']."</td> <td> < a href = "$_SERVER['PHP_SELF']?id = $count "> Update </a> </td> </tr>"; } It results in this error "Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in D:\xampp\htdocs\xampp\MagicLogin\includes\fra_register1.php on line 84". I have tried the following variations: < a href = "$_SERVER['PHP_SELF']? id = <? echo $count; ?> "> Update </a> < a href = "$_SERVER['PHP_SELF']?id = <? echo $count; ?> "> Update </a> < a href = "$_SERVER['PHP_SELF']? id = <?php echo '.$count.'; "> Update </a> < a href = "$_SERVER['PHP_SELF']? id = <? echo '$count'; "> Update </a> and maybe a few more I did not keep track of but the error persists and I can't figure it out. Please note that there is no actual variable like "id" that i am using in the statement ($_SERVER['PHP_SELF']? id= ) . So far as I know that only used to pass a value back to the program. This could be very stupid but could someone help me out. Thanks. Link to comment https://forums.phpfreaks.com/topic/285278-i-cant-get-past-this-link-statement/ Share on other sites More sharing options...
ginerjm Posted January 11, 2014 Share Posted January 11, 2014 So what is on line 84? Link to comment https://forums.phpfreaks.com/topic/285278-i-cant-get-past-this-link-statement/#findComment-1464805 Share on other sites More sharing options...
Ch0cu3r Posted January 11, 2014 Share Posted January 11, 2014 You need to concatenate the $_SERVER['PHP_SELF'] variable into the string, or wrap it within curly braces // wrapped in curly braces echo " ... <td> <a href={$_SERVER['PHP_SELF']}?id=$count>U pdate </a></td> </tr>"; // OR Concatenate echo " ... <td> <a href=".$_SERVER['PHP_SELF']."?id=$count>U pdate </a></td> </tr>"; Also if you want to output a double quote you need to escape it (\") echo " ... <td> <a href=\"".$_SERVER['PHP_SELF']."?id=$count\">U pdate </a></td> </tr>"; Link to comment https://forums.phpfreaks.com/topic/285278-i-cant-get-past-this-link-statement/#findComment-1464833 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.