Lawlssbatmbl Posted August 21, 2013 Share Posted August 21, 2013 (edited) $sql = "select satisfaction_id,satisfaction_type from satisfaction_type order by satisfaction_id"; $result = mysqli_query($db,$sql); while ($row=mysqli_fetch_array($result,MYSQLI_ASSOC)) { echo ("<tr><td>$row[satisfaction_type]</td>"); echo (' <td width="20"><a href="http://localhost/IC/satisfactioneditform.php?id=$row[satisfaction_id]"> <img src="images/Clipboard 3.png" width="20" height="20" title="Edit" border="0" /></a></td>'); echo (' <td width="20"><a href="http://localhost/IC/satisfactiondelete.php?id=$row[satisfaction_id]"> <img src="images/Close - Cancel 1.png" width="20" height="20" alt="" title="Delete" border="0" /></a></td></tr>'); } Need some help with the passing the value of $row[satisfaction_id] to the next php page. at present all im getting is the actual text for id as "$row[satisfaction_id" as apposed to the actual value which is a integer. The problem as I see it is the double quotes is probably stopping the variable being evaulated. so im geting just the variable name rather than the value . complex quoting issue had to use single quotes for the echo statement to get around the double quotes used in the html tag options. Thanks in advance. Edited August 21, 2013 by Lawlssbatmbl Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted August 22, 2013 Share Posted August 22, 2013 variables within double quotes are evaluated, variables within single quotes are not. Please use code tags to enclose your code when posting in the forum. you are using single quotes for your echo's and as such nothing within them will be evaluated, it is a forced string literal. you can either concatenate the string by doing something like: echo '<a href="./folder/subfolder/file.ext?id='.$row['satisfaction_id'].'">click here</a>'; or use only double quotes and escape the ones that you want to remain in the string : echo "<a href=\"./folder/subfolder/file.ext?id={$row['satisfaction_id']}\">click here</a>"; You will see in the second option that the array reference is wrapped in curly braces - this is deliberate Quote Link to comment Share on other sites More sharing options...
Lawlssbatmbl Posted August 22, 2013 Author Share Posted August 22, 2013 Thanks Alot , that solved my issue. Got really confusing using double quotes as I have a td and img tags that use double quotes and wasnt sure if I had to escape them all out . echo " <td width="20"><a href="./filename.php?id=$rows['name']"><img src="filename" width="16" height="16" /> </a></td> " echo " <td width=\"20\"><a href=\"./filename.php?id={$rows['name']}\"><img src=\"filename\" width=\"16\" height=\"16\" /> </a></td> " is the second one correct if using double quotes? Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted August 22, 2013 Share Posted August 22, 2013 yeah, the second one looks good at a glance (assuming you want to send the value of $row['name'] as the $_GET['id'] variable to the next page), the code highlighter seems to like it aswell, just remember your semi-colon at the end. Quote Link to comment Share on other sites More sharing options...
Lawlssbatmbl Posted August 22, 2013 Author Share Posted August 22, 2013 Thanks for all your help . You can consider this answered. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.