jamesxg1 Posted September 19, 2009 Share Posted September 19, 2009 Hiya guy's, I have this, <?php while($det = mysql_fetch_array($Dets)) { if(isset($det['name']) && isset($_GET['busid'])) { //THIS BIT WORKS echo '<label class="description" for="element_11"><img src="images/green_tick.gif" width="18" height="18"> You have selected ' . $det['name'] . '.</label>'; echo '<input id="busid" name= "busid" class="element text" maxlength="255" size="8" value="' . $det['id'] . '" type="hidden"/>'; echo '<input id="busname" name= "busname" class="element text" maxlength="255" size="8" value="' . $det['name'] . '" type="hidden"/><div></div>'; } else { //THIS DONT (JAVASCRIPT:AUTOSUGGEST()) IS WHAT ISNT WORKING. echo '<label class="description" for="element_11">Type To Search: </label><div><input name="search-q" id="search-q" type="text" class="element text medium" value="" onkeyup="javascript:autosuggest()"/></div>'; } } ?> I have labeled the areas, would someone assist here on helping me please, Many thanks, James. Quote Link to comment Share on other sites More sharing options...
ozestretch Posted September 19, 2009 Share Posted September 19, 2009 does it need to have 'javascript:' part? echo '<label class="description" for="element_11">Type To Search: </label><div><input name="search-q" id="search-q" type="text" class="element text medium" value="" onkeyup="autosuggest();" /></div>'; I also assume that actual function is coded somewhere I couldn't see Quote Link to comment Share on other sites More sharing options...
jamesxg1 Posted September 19, 2009 Author Share Posted September 19, 2009 Hiya dude, Yea crucial lol doesn't run otherwise lol, And lol yea it shows maybe abit too much information lmao , It works when i am not echoing it but when i do bang blows up in my face lol. Many thanks, James. Quote Link to comment Share on other sites More sharing options...
ozestretch Posted September 19, 2009 Share Posted September 19, 2009 Must be onClick that doesn't need it. Do you have variables in the function call? eg: onkeyup="autosuggest('var1',this.value);" Quote Link to comment Share on other sites More sharing options...
jamesxg1 Posted September 19, 2009 Author Share Posted September 19, 2009 Nope, Functions runs perfectly fine when i dont echo the input box but i have the diagnosis that it is the function that isn't being run because i am echoing it. Many thanks, James. Quote Link to comment Share on other sites More sharing options...
ozestretch Posted September 19, 2009 Share Posted September 19, 2009 have you tried to echo it only once? (one loop) Or does it fault regardless of single field use or multiple field use Quote Link to comment Share on other sites More sharing options...
jamesxg1 Posted September 19, 2009 Author Share Posted September 19, 2009 Faults, Because i am echoing it it doesn't even show the input box lol. Many thanks, James. Quote Link to comment Share on other sites More sharing options...
ozestretch Posted September 19, 2009 Share Posted September 19, 2009 Faults, Because i am echoing it it doesn't even show the input box lol. Many thanks, James. lmao, didn't mention it was not being displayed at all That line echo '<label class="description" for="element_11">Type To Search: </label><div><input name="search-q" id="search-q" type="text" class="element text medium" value="" onkeyup="javascript:autosuggest()"/></div>'; displays fine on my server... does this if(isset($det['name']) && isset($_GET['busid'])) { actually return false at any stage? Quote Link to comment Share on other sites More sharing options...
jamesxg1 Posted September 19, 2009 Author Share Posted September 19, 2009 Faults, Because i am echoing it it doesn't even show the input box lol. Many thanks, James. lmao, didn't mention it was not being displayed at all That line echo '<label class="description" for="element_11">Type To Search: </label><div><input name="search-q" id="search-q" type="text" class="element text medium" value="" onkeyup="javascript:autosuggest()"/></div>'; displays fine on my server... does this if(isset($det['name']) && isset($_GET['busid'])) { actually return false at any stage? Lmfao , Nope nothing lol, The if statement works i just cant seem to understand why the java isn't, I think and this is only a hunch but i think the enders might be muddled ( } ) and the else statement is in the wrong place , Many thanks, James. Quote Link to comment Share on other sites More sharing options...
ozestretch Posted September 19, 2009 Share Posted September 19, 2009 So the second choice of the else statement is returned at some point? <?php while($det = mysql_fetch_array($Dets)) { /* * we will change this to check it */ if(isset($somethingthatdoesnotexist)) { //THIS BIT WORKS - but wont now echo '<label class="description" for="element_11"><img src="images/green_tick.gif" width="18" height="18"> You have selected ' . $det['name'] . '.</label>'; echo '<input id="busid" name= "busid" class="element text" maxlength="255" size="8" value="' . $det['id'] . '" type="hidden"/>'; echo '<input id="busname" name= "busname" class="element text" maxlength="255" size="8" value="' . $det['name'] . '" type="hidden"/><div></div>'; } else { //THIS DONT (JAVASCRIPT:AUTOSUGGEST()) IS WHAT ISNT WORKING. /* * * THIS BIT IS ACTUALLY BEING OUTPUTTED RIGHT?? * lets check by changing something above ^^^^^^^^^^^ */ echo '<label class="description" for="element_11">Type To Search: </label><div><input name="search-q" id="search-q" type="text" class="element text medium" value="" onkeyup="javascript:autosuggest()"/></div>'; } } ?> Quote Link to comment Share on other sites More sharing options...
jamesxg1 Posted September 19, 2009 Author Share Posted September 19, 2009 Nothings being printed lmao. Many thanks, James. Quote Link to comment Share on other sites More sharing options...
jamesxg1 Posted September 19, 2009 Author Share Posted September 19, 2009 Anyone know how to fix this :S ? Many thanks, James. Quote Link to comment Share on other sites More sharing options...
jamesxg1 Posted September 19, 2009 Author Share Posted September 19, 2009 Bump. Quote Link to comment Share on other sites More sharing options...
ozestretch Posted September 19, 2009 Share Posted September 19, 2009 This works fine for me <?php $i=0; while($i<3) { /* * we will change this to check it */ if(isset($somethingthatdoesnotexist)) { //THIS BIT WORKS - but wont now echo '<label class="description" for="element_11"><img src="images/green_tick.gif" width="18" height="18"> You have selected ' . $det['name'] . '.</label>'; echo '<input id="busid" name= "busid" class="element text" maxlength="255" size="8" value="' . $det['id'] . '" type="hidden"/>'; echo '<input id="busname" name= "busname" class="element text" maxlength="255" size="8" value="' . $det['name'] . '" type="hidden"/><div></div>'; } else { //THIS DONT (JAVASCRIPT:AUTOSUGGEST()) IS WHAT ISNT WORKING. /* * * THIS BIT IS ACTUALLY BEING OUTPUTTED RIGHT?? * lets check by changing something above ^^^^^^^^^^^ */ $echo '<label class="description" for="element_11">Type To Search: </label><div><input name="search-q" id="search-q" type="text" class="element text medium" value="" onkeyup="javascript:autosuggest()"/></div>'; } $i++; } ?> so I guess you know where to look Quote Link to comment Share on other sites More sharing options...
jamesxg1 Posted September 19, 2009 Author Share Posted September 19, 2009 This works fine for me <?php $i=0; while($i<3) { /* * we will change this to check it */ if(isset($somethingthatdoesnotexist)) { //THIS BIT WORKS - but wont now echo '<label class="description" for="element_11"><img src="images/green_tick.gif" width="18" height="18"> You have selected ' . $det['name'] . '.</label>'; echo '<input id="busid" name= "busid" class="element text" maxlength="255" size="8" value="' . $det['id'] . '" type="hidden"/>'; echo '<input id="busname" name= "busname" class="element text" maxlength="255" size="8" value="' . $det['name'] . '" type="hidden"/><div></div>'; } else { //THIS DONT (JAVASCRIPT:AUTOSUGGEST()) IS WHAT ISNT WORKING. /* * * THIS BIT IS ACTUALLY BEING OUTPUTTED RIGHT?? * lets check by changing something above ^^^^^^^^^^^ */ $echo '<label class="description" for="element_11">Type To Search: </label><div><input name="search-q" id="search-q" type="text" class="element text medium" value="" onkeyup="javascript:autosuggest()"/></div>'; } $i++; } ?> so I guess you know where to look Nope nothing, not working lol. Jheez this script snippet is a nightmare lmao Quote Link to comment Share on other sites More sharing options...
ozestretch Posted September 19, 2009 Share Posted September 19, 2009 have you run the above code on its own page? I have and it executes the way it should. If so then I am out of ideas. Good luck Quote Link to comment Share on other sites More sharing options...
jamesxg1 Posted September 19, 2009 Author Share Posted September 19, 2009 I got it working , Thanks for your time and help dude much appreciated have a nice weekend mate, take care, Many many thanks, James. Quote Link to comment Share on other sites More sharing options...
ozestretch Posted September 19, 2009 Share Posted September 19, 2009 I was out of ideas at post#66 from me.... you posted with success on post #666 was it line 6 that was causing the issues? haha Glad you got it... what was it? PEBKAC? 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.