Jump to content

noobstar

Members
  • Posts

    93
  • Joined

  • Last visited

    Never

Everything posted by noobstar

  1. Yea it would be a way of going about it however, what I failed to mention (sorry about that) is that there are multiple forms with the same name so i need to distinguish between the buttons pressed for each of those hence why I did as shown above.
  2. With most browsers I believe as soon as they hit the Back button it sends them back to the previous page plus to the position they were on last automatically. However, if you are referring to being able to flip between positions on the same page then you could use anchor tags and lock those to certain name tags set on particular sections on the page. Here is an example of what I mean: <div name="section1"></div> <a href="#section1">Section 1</div> <div name="section2"></div> <a href="#section2">Section 1</div> Sorry if I wasn't much of a help
  3. Hi Everyone This has me rather puzzled. I've checked numerous websites to no avail and threw at it all I could muster without any luck. All I'm after is basically to check which submit button within a form has been clicked i.e. add user, delete user, update user blablabla I have two pages test.html and test.php. test.html <div id="feedback"></div> <form class="user_form"> <input type="text" name="name" /> <input type="submit" name="add_user" value="Add User" /> <input type="submit" name="delete_user" value="Delete User" /> </form> test.php <?php if ($_POST['add_user']) { echo "add user: ".$_POST['name']; } if ($_POST['delete_user']) { echo "delete user: ".$_POST['name']; } ?> javascript/jquery <script type="text/javascript"> $(document).ready ( function() { $(".user_form").submit ( function () { if () { // add_user is clicked $.post("test.php", { add_user: $(this.add_user).val(), name: $(this.name).val()}, function(data) { $("#feedback").html(data); }); } if () { // delete_user is clicked $.post("test.php", { delete_user: $(this.delete_user).val(), name: $(this.name).val()}, function(data) { $("#feedback").html(data); }); } } } ); </script> If there is a better way of going about this problem please let me know Thank you very much for any help!
  4. Thank you very much for the point in the right direction sticks464 I appreciate this greatly! Regards what jcombs_31 said, both divs are inside another div which has a background colour attached (I failed to mention this, sorry about that) when both divs are floated left and right the div container they are in doesn't auto size the height that's why i was trying to find out if there is another method in doing this. Again thank you very much
  5. My problem is this as odd as it may sound I've honestly never needed to use this and now when I do its a real noodle scratcher. I got 2 divs, example: <div>This is some text</div> <div>This is some text too</div> The thing I want to do is keep both divs on the same line as well as move the second div to the right side. Now putting both divs inline is easy however, if I use the inline the float on the second div doesn't work properly it sort of nudges it one line down. Please if anyone has a better method in doing this I could really use the help in this. Thank you very much in advance for any help what so ever
  6. Sadly no dice it throws out an error Warning: sort() expects parameter 1 to be array, null given in /hermes/bosweb/web279/b2793/ipw.ab270387/public_html/gameomen/admin/game_core.php I tried that as well yesterday but this wouldn't work with what im trying to do, here i'll give you an example on why: Take the these as an example: 16(item_ID),12(quantity),14(item_ID),6(quantity) If I sorted this which would be inside the $weap_pieces it would completely bring the order into chaos hence me using $piece to grab the item_IDs only and then trying to sort them out. I hope your catching on what i'm saying.. im generally terrible at explaning stuff haha
  7. Yea, I did a lot of Googling and I did check that link out since it was pretty much the first one that popped up though I couldn't make heads or tails of it. As I am seeing it now from the PHP Sort (manual) they have an Array with preset values that they sort, well i wish i could do this and believe me i've been trying for about a day and a half :S Since I don't know how many values there will be in the column within the database table I cannot preset an Array to perform the sort.. soo back to square one lol Btw, its supposed to sort from Lowest to Highest number. EDIT: I've done each thing i needed into its separate function so here is the whole code so you have an general idea of what i'm trying to do function weapon_fill() { $username = $_SESSION['player_ID']; $player_inv_q = mysql_query("SELECT * FROM `mobUplayer_stats` WHERE `player_ID` = '$username'"); $weapons_q = mysql_query("SELECT * FROM `mobUitems` WHERE `items_cat` = 'weapon'"); $player_inv = mysql_fetch_assoc($player_inv_q); // IDs need to go from low to high $weap_pieces = explode(",", $player_inv['stats_weapons']); $weap_piece_count = count($weap_pieces) - 1; $weapi=0; $weapID=0; $id=0; for($i=0;$weapID <= $weap_piece_count;$i++) { $piece[$i] = $weap_pieces[$weapID]; $weapID+=2; } echo $piece[0].",".$piece[1].",".$piece[2].",".$piece[3]; while($weapon_r = mysql_fetch_assoc($weapons_q)) { echo "<tr><td align='right'>".$weapon_r['items_product']."</td>"; echo "<td> <span style='color:lightgreen'>$</span><input type='text' name='txtweap_cost[".$id."]' value='".weapon_item_event($weap_type=$id)."' style='background-color:#733030;border:none;color:lightgreen;' size='7' disabled /></td>"; echo "<td> <button onclick='if(document.getElementById(\"weap".$id."\").style.display==\"none\"){document.getElementById(\"weap".$id."\").style.display=null}else{document.getElementById(\"weap".$id."\").style.display=\"none\"}'>Buy</button></td>"; //echo "ID: ".$weapon_r['items_ID']." Weap piece ID: ".$weap_pieces[$weapID]." Weap ID: ".$weapID."<br/>"; // IF the player has the certain weapon, display Sell button if($weapi == 0) { if($weap_pieces[$weapID] == $weapon_r['items_ID']) { echo "<td><button onclick='if(document.getElementById(\"weapsell".$id."\").style.display==\"none\"){document.getElementById(\"weapsell".$id."\").style.display=null}else{document.getElementById(\"weapsell".$id."\").style.display=\"none\"}'>Sell</button></td>"; $weapID+=2; } $weapi=1; } else { $weapi=0; } echo "<td valign='top'><div id='weap".$id."' style='display:none'> <form method='post' action='admin/game_core.php?cmd=buy_weapon' style='display:inline'> <input type='text' name='weapon_".$weapon_r['items_product']."' size='2' maxlength='6' /> units <input type='submit' name='weap".$weapon_r['items_ID']."_Done' value='Done' /> </form></div></td>"; $weapID--; echo "<td valign='top'><div id='weapsell".$id."' style='display:none'> <form method='post' action='admin/game_core.php?cmd=sell_drug' style='display:inline'> <input type='text' name='drug_".$weapon_r['items_product']."' value='".$drug_pieces[$drugID]."' size='2' maxlength='6' /> Kg <input type='submit' name='drug".$weapon_r['items_ID']."_Done' value='Done' /> </form></div></td></tr>"; $weapID++; $id++; } } There is a whole heap of it so i highly doubt you'd wanna waste your time reading through it :S Basically speaking why I am trying to sort the numbers of $piece from lowest to highest is so i can check it one by one against the loading items (weapons) and display a Sell button next to the Buy button
  8. Thank you very much for your reply Yea you got a point there though it works with what i got there at the moment, it lists them out properly as well. How do you go about sorting those values though?
  9. Good evening everyone I'm building a very small game to experiment with the explode() option in PHP since i never have tried it before i thought this would be a interesting way to getting to know it. In my table in the database i have a column that stores values like this: 16,12,14,6,12,1,17,1 Here is the code i have as it is now: // Takes in the values using the commas it separates $weap_pieces = explode(",", $player_inv['stats_weapons']); // Counts how many values there are in $weap_pieces & subtracts 1.. // so it starts from 0 (zero) $weap_piece_count = count($weap_pieces) - 1; $weapID=0; // I only need the IDs in other words i increment weapID by 2.. // so i take only 16,14,12 & 17 (these numbers are only examples) for($i=0;$weapID <= $weap_piece_count;$i++) { $piece[$i] = $weap_pieces[$weapID]; $weapID+=2; } My question.. finally lol.. is how do you go about sorting $piece from the lowest number to the highest so using the example from above so I get it sorted to 12,14,16,17? Thank you in advance for any help what so ever!
  10. Sorry for a double post but just to add onto it I chucked in a second while statement (the one that displays links to the folders) inside the for loop along with the Combobox while loop and as the combobox while loop it only displays the links to the folders ones and that's it. From what i gather its ... A) You can't display the stuff from the database more then ones (which i think is rubbish cause i'm sure i've done it before) B) There is something wrong with 'MAMP' >.>
  11. The output code is above in the PM.php script file, if that's what you mean. Just to show you what happens here is a screenshot: As you can see it does it without problems on the first combo box but the other 2 remain empty ... Very very odd EDIT: I just wanted to further test it so i wrapped the While loop inside a For loop so it basically duplicates the output 4 times, code is shown below: for($i=0;$i<=3;$i++) { echo "<select name='cboMoveOpt' class='textbox_button'>"; while($PM_Folders_ComboB_R = mysql_fetch_assoc($PM_Folders_ComboB_Q)) { echo "<option value='".$PM_Folders_ComboB_R['folders_Name']."'>".$PM_Folders_ComboB_R['folders_Name']."</option>"; } echo "</select>"; } The output is exactly the same as the other code it does it perfectly for the first time and then its blank for the other 3 combo boxes
  12. Well this has to be the stupidest thing i've seen, ive done this so many times before yet this stupid thing alludes me i can't seem to see the problem with it. What i have here is a simple messaging service that displays all messages sent to the particular user. I've got 3 sample messages in there for testing now next to each of the messages it should have a combo box that will display options of Folders they created to move the messages to that area. Now, the problem lies on the combo box it does it perfectly on the first message but when it creates the other 2 combo boxes (for the other 2 sample messages) they come out blank, which doesn't make any sense to me what so ever . Have a look at the Code below and you might be able to figure it out cause i've been pondering for over 2 days now: PM.PHP <table border="0" width="650"> <tr> <td class="SideNote" align="center">Folders</td> <td class="SideNote" align="center">Delete</td> <td class="SideNote" align="center">From</td> <td class="SideNote" align="center">Subject</td> <td class="SideNote" align="center"></td> </tr> <?php echo "<tr>"; $RowspanFolders = $MessageResult['MessageCount'] + 1; echo "<td class='MessageBorder' style='padding-left:15px;text-align:left' width='150' rowspan='".$RowspanFolders."'>"; while($PM_Folders_Links = mysql_fetch_assoc($PM_Folders_Query)) { echo "<img src='images/foldericon.png' />"; echo "<a href='pm.php?folder=".$PM_Folders_Links['folders_Name']."'>".$PM_Folders_Links['folders_Name']."</a><br/>"; } echo "<br/><a href='pm.php?newfolder=true'>New Folder</a></td></tr>"; while($InboxResult = mysql_fetch_assoc($InboxQuery)) { echo "<tr>"; echo "<td class='MessageBorder'><input type='checkbox' name='chkDelete' class='SideNote' /></td>"; echo "<td class='MessageBorder' width='80'><span class='SideNote'>".$InboxResult['pmbox_From']."</span></td>"; echo "<td class='MessageBorder' width='450'><a href='pm.php?checkmsg=true&pmbox_ID=".$InboxResult['pmbox_ID']."'>".$InboxResult['pmbox_Subject']."</a></td>"; echo "<td class='MessageBorder'><select name='cboMoveOpt' class='textbox_button'>"; //This is the bit that fails for some odd reason while($PM_Folders_ComboB_R = mysql_fetch_assoc($PM_Folders_ComboB_Q)) { echo "<option value='".$PM_Folders_ComboB_R['folders_Name']."'>".$PM_Folders_ComboB_R['folders_Name']."</option>"; } echo "</select></td>"; } echo "</tr>"; ?> </table> QUERIES.PHP <?php $SitemapQuery = mysql_query("SELECT * FROM rstar_links") or die('Sitemap query did not work!'); $MessageQuery = mysql_query("SELECT count(pmbox_ID) as MessageCount FROM rstar_pmbox WHERE pmbox_To = '".$_SESSION['username']."'") or die('Message query failed'); $MessageResult = mysql_fetch_assoc($MessageQuery) or die('Message result did not get query'); $InboxQuery = mysql_query("SELECT * FROM rstar_pmbox WHERE pmbox_To = '".$_SESSION['username']."'") or die('Inbox query failed'); $NewsfeedQuery = mysql_query("SELECT * FROM rstar_newsfeed") or die('Newsfeed query failed'); $NewsfeedResult = mysql_fetch_assoc($NewsfeedQuery); $PMDisplay = mysql_query("SELECT * FROM rstar_pmbox WHERE pmbox_ID = '".$_REQUEST['pmbox_ID']."'") or die('PMDisplay query failed'); $PMDisplayResult = mysql_fetch_assoc($PMDisplay); $PM_Folders_ComboB_Q = mysql_query("SELECT * FROM rstar_pmbox_folders WHERE folders_Username = '".$_SESSION['username']."'") or die('PM_Folders_ComboB_Q failed!'); $PM_Folders_Query = mysql_query("SELECT * FROM rstar_pmbox_folders WHERE folders_Username = '".$_SESSION['username']."'") or die('PM_Folders_Query failed!'); $PM_Folders_Count = mysql_query("SELECT count(folders_ID) as FolderCount FROM rstar_pmbox_folders WHERE folders_Username = '".$_SESSION['username']."'") or die('PM_Folders_Count query failed!'); $PM_Folders_Count_R = mysql_fetch_assoc($PM_Folders_Count); ?> Thank you for any help what so ever!
  13. Hi there everyone I have this really weird problem i've never come across i have two divs and the bottom div doesn't seem to move as text is added to the top div. Here is the code i got in the HTML file: <table border="0" align="center"> <tr> <td valign="top" align="center" width="200"> <div id="pnlCategory"> <br/><br/><br/><br/> <a href="">Fiction</a><br/> <a href="">Cooking</a><br/> <a href="">Gardening</a><br/> <a href="">Fiction</a><br/> <a href="">Cooking</a><br/> <a href="">Gardening</a><br/> <a href="">Fiction</a><br/> <a href="">Cooking</a><br/> <a href="">Gardening</a><br/> <a href="">Fiction</a><br/> <a href="">Cooking</a><br/> <a href="">Gardening</a><br/> </div> <div id="pnlNewsletter"></div> </td> </tr> </table> And here is the CSS i got: div#pnlCategory { background-image:url(images/categories.png); background-repeat:no-repeat; height:78px; width:144px; text-align:center; } div#pnlNewsletter { background-image:url(images/newsletter.png); background-repeat:no-repeat; height:78px; width:147px; text-align:center; } Edit: Almost forgot I'm using Dreamweaver for this Thank you very much for any help
  14. Thanks for the reply emehrkay your code worked nicely!!
  15. I think its because the Navigation Panel pushes the first 2 tables to the right while the other 3 are pushed by the left side panel to the left while the rest of them align properly into the center. Best thing to do is chuck all your panels into a big table and then in the middle area you can have a loop of news tables as you have now. This should make everything align properly. Here is what i mean:
  16. Hi, im was fiddling with the prompt to try and somehow when a user clicks on a button would ask for his/her name and then display it however, it didn't work out but it did work this way without a function: <script language="JavaScript"> var name = prompt('hello', ''); </script> <?php $hello = "<script language=JavaScript>document.write(name);</script>"; echo "$hello<br/>"; ?> My question is how could i make this work when someone clicks a button instead of it prompting the user when ever he/she loads the page? I tried this but I am sure its something to do with the variable not being passed because its only used within the function and its not usable for some reason outside it. How could i go about making the variable available for any outside functions or other scripts ? <script language="JavaScript"> function prompter(name) { name = prompt('hello', ''); } </script> <?php $hello = "<script language=JavaScript>document.write(name);</script>"; echo "$hello<br/>"; ?> <input type="button" onClick="prompter();">
  17. Hi, im tring to get this to work however, im unsure how to. When you type lets say this into a textarea box and save it into a variable: This is a test 1 2 3 And when you display it through echo it will just show this in a straight line i.e. This is a test 1 2 3. My question is is there a way to retain the breaks inbetween just the way its written in the textarea box ? Thanks again
  18. Hi what im tring to do is basically this: I have 2 radio buttons if one is clicked it goes to one function and is supposed to set a variable to a value. If the other radio button is clicked it goes to another similar function and is supposed to set the same variable to something else though. This works only for one but not the other for some reason, below is the code. Thank you for any help in adv. Javascript: <SCRIPT LANGUAGE='JavaScript'> <!-- Begin redirTime = '2000'; redirURL = 'http://www.test.test.com/shout.php'; function artpickOut() { <?php $artpick = "Outside Article"; ?> self.setTimeout('self.location.href = redirURL;',redirTime); } function artpickMy() { <?php $artpick = "My Article" ?> self.setTimeout('self.location.href = redirURL;',redirTime); } // End --> </script> My radio buttons: <input type="radio" name="optArtPick" value="Outside Article" onClick="artpickOut()">Outside Article <input type="radio" name="optArtPick" value="My Article" onClick="artpickMy()">My Article thanks again!
  19. I got rid of all the tables as you suggested however, the main problem for this was that it was one huge word so i replaced it with some sentences and it worked thank you for your help m8
  20. Thanks for your reply and i did try static and it didn't work either the text still goes in a straight line Here is the code i have in my html (note: this isn't all of the code the whole page is rather long): <td width="515" height="422" valign="top" id="contentbox"> <div id="date" align="center"><span class="month">Mar</span><br/><span class="day">03</span></div> <div id="creator">Posted by <font color="#FF0000">testy</font><br/>Mar 03 2007 14:45pm</div> <div id="comment" class="default_font">sdgdfgdfgdfgdfgdfgbfbdggnfhtfjghhdfshfdghfgjghjmghfnhgmfgjghjmghfnhgmfgjghjmghfnhgmfgjghjmghfnhgm</div> </td> Here is the CSS code within the div tags seen above: div#comment { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; color:#000000; position:relative; left:38px; top:-20px; width:350px; height:auto; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:#333333; border-left-style:solid; border-left-width:1px; border-left-color:#333333; border-right-style:solid; border-right-width:1px; border-right-color:#333333; } div#creator { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; color:#000000; border-bottom-style:solid; border-bottom-width:1px; position:relative; left: 38px; top: -26px; width:350px; } div#date { background-color:#CC9999; border-top-style:solid; border-top-width:1px; border-top-color:#333333; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:#333333; border-left-style:solid; border-left-width:1px; border-left-color:#333333; border-right-style:solid; border-right-width:1px; border-right-color:#333333; padding-top:5px; height:38px; width:35px; } Here is an image example of what i am talking about:
  21. Hi im trying to fix the width inside a div tag using css however, even though i set the width to 350px and after placing a excessive amount of text, the text just flows in a straight line instead of breaking up. Can anyone lend a hand ? Thx Below is the code i have: div#comment { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; color:#000000; position:relative; left:38px; top:-20px; width:350px; height:100px; }
  22. sweet i will give both a try thank you for the replies guys
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.