PHP making an URL link work inserting the $variables the right syntax way -
i have link works.
echo '<a href="?country=estonia&from_language=russian&into_language=latvian&submitted=true& page='.$x. '">'.$x.'</a> '; but need nouns estonia, russian , latvian replaced scalar variables $country, $from_language, $into_language.
i have tried possible combinations of dots , single , double quotes. syntax errors. don't know how embed variables there.
anybody knows?
thank you
use easy 1 sprintf or printf.
eg:
printf('<a href="?country=%s&from_language=%s&into_language=%s&submitted=true& page=%s">%s</a>', $country, $fromlanguage, $tolanguage, $pageid, $disptext); you use encoding double quote sign like:
echo "<a href=\"?country={$country}&from_language={$fromlanguage}&into_language={$tolanguage}&submitted=true& page={$pageid}\">{$disptext}</a>"
Comments
Post a Comment