Velodrome Posted November 29, 2006 Share Posted November 29, 2006 Help!I'm extremely new to php and have a very simple problem. I cannot see my constant value in a table cell.Please somebody help me thank you. part of the code:define("CAR", "Volvo");echo("<table border=1>");echo("<tr>");echo("<th>Car</th><th>Model</th>th><th>Consumption</th><th>Retail Price</th>");echo("</tr>"); echo("<tr align=center>"); echo("<td>CAR</td>"); [color=red]// This is where i want my constant value to be displayed[/color] echo("<td>$model1</td>"); echo("<td>$consumption1</td>"); echo("<td>$price1 €</td>"); echo("</tr>"); Link to comment https://forums.phpfreaks.com/topic/28888-read-constant-value-in-table-cell/ Share on other sites More sharing options...
kenrbnsn Posted November 29, 2006 Share Posted November 29, 2006 PHP can't distinguish a constant from a regular literal string when it is enclosed in quotes.Use the following instead:[code]<?phpecho "<td>" . CAR . "</td>";?>[/code]BTW, you don't need the parenthesis when using the echo statement.Ken Link to comment https://forums.phpfreaks.com/topic/28888-read-constant-value-in-table-cell/#findComment-132284 Share on other sites More sharing options...
Velodrome Posted November 29, 2006 Author Share Posted November 29, 2006 Thank you very much! This is exactly what i needed! Link to comment https://forums.phpfreaks.com/topic/28888-read-constant-value-in-table-cell/#findComment-132293 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.