the5thace Posted July 19, 2013 Share Posted July 19, 2013 The variable $q_words[$loop_count-1] is shown in the top besides Did you mean? but it fails to come up inside of the hyperlink. Any ideas to why? <?php if ($_POST['query']) { $query = ($_POST['query']); $q_words = explode (" ", $query); $loop_count = 0; $q_count = count(q_words); $s_count = 0; $ss_count = 0; while ($loop_count <= $q_count ) { $query = 'http://www.dictionaryapi.com/api/v1/references/collegiate/xml/'.$q_words[$loop_count].'?key=135a6187-af83-4e85-85c1-1a28db11d5da'; $xml = new SimpleXMLIterator(file_get_contents($query)); foreach ($xml -> suggestion as $suggestion[$s_count]) { $s_count++; } if ($s_count > 1) { echo ('<h4>Did you mean ....? '.$q_words[$loop_count-1].'</h4>'); while ($ss_count <=$s_count) { echo '<a href = "AllinOneMonstaaa.php?query='.$q_words[loop_count-1].' '.$suggestion[$ss_count].'">'.$q_words[loop_count-1].' '.$suggestion[$ss_count].'</a><br>'; $ss_count++; } } $loop_count++; } } Link to comment https://forums.phpfreaks.com/topic/280318-why-echo-does-not-work-on-php-variable-the-second-and-third-time/ Share on other sites More sharing options...
trq Posted July 19, 2013 Share Posted July 19, 2013 You are missing the $ off the variable $loop_count You really should have error reporting enabled when developing. Link to comment https://forums.phpfreaks.com/topic/280318-why-echo-does-not-work-on-php-variable-the-second-and-third-time/#findComment-1441389 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.