follyfoot Posted December 14, 2007 Share Posted December 14, 2007 Hi all, I've created the following form; // Form with all teams function get_form() { $s .= '<form action="' . $_SERVER['SCRIPT_NAME'] . '">' . "\n"; $s .= '<textarea name="names" rows="8" cols="40">' . "\n"; $s .= 'echo $tname;' . "\n"; $s .= '</textarea>' . "\n"; $s .= '<input type="submit" value="Generate Fixtures" />' . "\n"; $s .= "</form>\n"; return $s; } but the problem is the echo $tname is outputing as "echo $tname" instead of the variable, it seems it won't recognise php within the form. Any help you would greatly appriciated Many thanks Folly Link to comment https://forums.phpfreaks.com/topic/81679-putting-php-into-a-problem/ Share on other sites More sharing options...
adam291086 Posted December 14, 2007 Share Posted December 14, 2007 'echo $tname;' . "\n"; change to echo $tname. "\n"; Link to comment https://forums.phpfreaks.com/topic/81679-putting-php-into-a-problem/#findComment-414873 Share on other sites More sharing options...
revraz Posted December 14, 2007 Share Posted December 14, 2007 Could probably do it without echo too. But your single quotes are what is making it the actual name instead of what the variable contains. Link to comment https://forums.phpfreaks.com/topic/81679-putting-php-into-a-problem/#findComment-414874 Share on other sites More sharing options...
follyfoot Posted December 14, 2007 Author Share Posted December 14, 2007 hmm getting a nasty Parse error: syntax error, unexpected T_ECHO in W:\www\league\fixture3.php on line 34 error Link to comment https://forums.phpfreaks.com/topic/81679-putting-php-into-a-problem/#findComment-414875 Share on other sites More sharing options...
adam291086 Posted December 14, 2007 Share Posted December 14, 2007 whats at line 34 can't help without know where the error is Link to comment https://forums.phpfreaks.com/topic/81679-putting-php-into-a-problem/#findComment-414878 Share on other sites More sharing options...
follyfoot Posted December 14, 2007 Author Share Posted December 14, 2007 o sorry my mistake 30 - // Form with all teams 31 - function get_form() { 32 - $s .= '<form action="' . $_SERVER['SCRIPT_NAME'] . '">' . "\n"; 33 - $s .= '<textarea name="names" rows="8" cols="40">' . "\n"; 34 - $s .= echo blah; . "\n"; 35 - $s .= '</textarea>' . "\n"; 36 - $s .= '<input type="submit" value="Generate Fixtures" />' . "\n"; 37 - $s .= "</form>\n"; 38 - return $s; 39 - } Link to comment https://forums.phpfreaks.com/topic/81679-putting-php-into-a-problem/#findComment-414890 Share on other sites More sharing options...
kjtocool Posted December 14, 2007 Share Posted December 14, 2007 34 - $s .= echo blah; . "\n"; should be: 34 - $s .= echo 'blah' . "\n"; Link to comment https://forums.phpfreaks.com/topic/81679-putting-php-into-a-problem/#findComment-414892 Share on other sites More sharing options...
revraz Posted December 14, 2007 Share Posted December 14, 2007 or echo $tname. "\n"; as stated before or echo "$tname \n"; Link to comment https://forums.phpfreaks.com/topic/81679-putting-php-into-a-problem/#findComment-414895 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.