how to use multiple url variables in php echo statement -
i trying execute code 1 below , try figure out have missed do, seems bit complicated, tips or guidance easy way use comma, quotes pls.
echo "<td><a href='update.php?jobrequestnumber$counterforlist=\".$row['jobrequestnumber'].\"&requestingcompany$counterforlist=$row['requestingcompany'].\"&dateforservice$counterforlist=$row['dateforservice']."'>update</a></td>";
many
due method of variable parsing in php, when $ encountered within double quotes parser attempt retrieve variable characters following $. result, not need escape string in order have variable parsed properly. parsing method referred simple syntax. alternative simple syntax complex syntax uses {...}
encase variables.
in case recommend using complex syntax allow easier code maintenance/maintainability.
echo "<td><a href=\"update.php?jobrequestnumber{$counterforlist}={$row['jobrequestnumber']}&requestingcompany{$counterforlist}={$row['requestingcompany']}&dateforservice{$counterforlist}={$row['dateforservice']}\">update</a></td>";
if using single quotes encase string following solution utilizes simple syntax work:
echo '<td><a href="update.php?jobrequestnumber'. $counterforlist .'='. $row['jobrequestnumber'] .'&requestingcompany'. $counterforlist .'='. $row['requestingcompany'] .'&dateforservice'. $counterforlist .'='. $row['dateforservice'] .'">update</a></td>';
there multiple approaches case , find range of answers due nature of site approach wish utilize. may more favorable others in terms of performance, purposes not observe noticeable differences.
please reference manual further explanation.
Comments
Post a Comment