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 Quote Link to comment 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"; Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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 - } Quote Link to comment 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"; Quote Link to comment 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"; 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.