lynm77 Posted March 6, 2012 Posted March 6, 2012 (edited) Hello All I'm hoping someone may be able to help me. On my Inventory page i have been attempting to set a info popup page. I have added the following to header <script type="text/javascript"> <!-- function myPopup2() { window.open( "http:/description.php?ID={$i['itmid']}'", "myWindow", "status = 1, height = 300, width = 300, resizable = 0" ) } //--> </script> Then added the following to Info Button on the Inventory page echo "</td><td>\${$i['itmsellprice']}</td><td>"; echo "$".($i['itmsellprice']*$i['inv_qty']); echo "</td><td><img src='itmpics/{$i['itmpic']}' height='50px' width='50px'>"; echo "</td><td><form> <input type='button' onClick='myPopup2()' value='Info'> </form> [<a href='addtoshop.php?ID={$i['inv_id']}'>Put in Shop</a>] [<a href='itemsend.php?ID={$i['inv_id']}'>Send</a>] [<a href='itemsell.php?ID={$i['inv_id']}'>Sell</a>] [<a href='imadd.php?ID={$i['inv_id']}'>Add To Market</a>]"; if($i['itmid']=='1') I have it that it pops up a new pop up window but not the correct details on item Its is showing the following details in Browser only. http://www.xxxxxxx.com/description.php?ID=' Can someone help he to correct the following please. Thank You Edited March 6, 2012 by lynm77 Quote
rulerofzu Posted March 6, 2012 Posted March 6, 2012 Your not passing the item id sorry to state the obvious. Without the rest of the code its impossible to see where your going wrong. Quote
lucky3809 Posted March 6, 2012 Posted March 6, 2012 (edited) It works for me, tested it where are you placing this part of the code? <script type="text/javascript"> <!-- function myPopup2() { window.open( "http:/description.php?ID={$i['itmid']}'", "myWindow", "status = 1, height = 300, width = 300, resizable = 0" ) } //--> </script> I added it under the query then changed it to... echo <<<EOF <script type="text/javascript"> <!-- function myPopup2() { window.open( "iteminfo.php?ID={$i['itmid']}", "myWindow", "status = 1, height = 300, width = 300, resizable = 0" ) } //--> </script> EOF; and it worked just fine... Edited March 6, 2012 by lucky3809 Quote
HauntedDawg Posted March 6, 2012 Posted March 6, 2012 (edited) First of all, doesnt matter where you place the code. Secondly, let's look at the obvious, <script type="text/javascript"> <!-- function myPopup2() { window.open( "http:/description.php?ID={$i['itmid']}'", "myWindow"+item, "status = 1, height = 300, width = 300, resizable = 0" ) } //--> </script> You see the {$i['itmid']}? Ok, let's fix this to be "+item+". Remove the ' also. Then make the function like so: function myPopup2(item) {. Now that that is done. If you can not see this, then your blind. http:/description.php, just type that into your browser and see where your going to. This has to be description.php only. Ok, that's the javascript and hope you can solve it. Here's the php code: echo '</td><td>$'.$i['itmsellprice'].'</td><td>'; echo '$'.($i['itmsellprice'] * $i['inv_qty']); echo '</td><td><img src="itmpics/'.$i['itmpic'].'" style="height: 50px; width: 50;px;">'; echo '</td><td><form><input type="button" onClick="myPopup2('.$i['itmid'].');return false;" value="Info"></form> [<a href="addtoshop.php?ID='.$i['inv_id'].'">Put in Shop</a>] [<a href="itemsend.php?ID='.$i['inv_id'].'">Send</a>] [<a href="itemsell.php?ID='.$i['inv_id'].'">Sell</a>] [<a href="imadd.php?ID='.$i['inv_id'].'">Add To Market</a>]'; and the javascript if you didnt understand <script type="text/javascript"> function myPopup2(item) { window.open('description.php?ID='+item, 'infoItem', 'status = 1, height = 300, width = 300, resizable = 0'); } </script> Edited March 6, 2012 by HauntedDawg Quote
lynm77 Posted March 6, 2012 Author Posted March 6, 2012 (edited) Hello HauntedDawg I have tried the changes above but when i click on the button INFO I get no action at all now. Any more help in resolving this problem would be great. Thanks Edited March 6, 2012 by lynm77 Quote
lynm77 Posted March 6, 2012 Author Posted March 6, 2012 Hello HauntedDawg Thank you so much for your help. All is working now. Cheers Quote
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.