Jump to content

pengu

Members
  • Posts

    154
  • Joined

  • Last visited

    Never

Everything posted by pengu

  1. Amazing, thought someone would respond by now. Anyways, I've got this far (see code). But it's not loading my pages into the DIV. Works firefox. No go Chrome. <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $(document).ready(function() { $('.spLink').click(function(e) { e.preventDefault(); var href = $(this).attr('href'); $('.spResult').load(href); //alert(href); }); }); </script> </head> <body> <h1>Test</h1> <p><a href="./test.html" class="spLink">Click</a></p> <p><a href="test2.html" class="spLink">Click</a></p> <p><a href="test3.html">Click</a></p> <div class="spResult"> </div> </body> </html>
  2. First off, I hope I've posted this in the correct spot. Apologies if I have not. All I want is a couple of links, lets say 1 2 and 3, they're all href links that lead to some page, but they have an "id" within the HREF. So when I click them, I want them to load the results into a div, not just load another page. What I have so far.. <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $("#spLink").click(function(){ $("#spResult").html(ajax_load).load(); }); </script> </head> <body> <h1>Test</h1> <p><a href="test.html" id="spLink">Click</a></p> <p><a href="test2.html" id="spLink">Click</a></p> <p><a href="test3.html" id="spLink">Click</a></p> <div id="spResult"> </div> </body> </html> Help!
  3. Hi, I'm trying to figure out how to get some numbers out of a string. Example of strings $string1 = "3-tech"; $string2 = "109-bobby"; $string3 = "4-Charlie1994"; $string4 = "55-Mr-Smith"; What I want to do is grab everything BEFORE the "-" and the first dash. I'm having a brain meltdown atm and just can't figure it out, I know it's something simple.
  4. Thanks for your help.. but I disagree about security. Performance I'm not quite sure. Will wait to see what others say.
  5. It doesn't appear to have anything to do with the mail() function. Echo out $body to make sure there is no errors with it. Seems to be an error with your hosting.
  6. I can't post too much.. sorry. Basically vBulletin is able to do something as following. somepage.php <?PHP include "globals.php"; //can't remember what it is exactly called.. echo $vbulletin->userinfo["userid"]; echo $vbulletin->userinfo["posts"]; //etc etc ?> Now I have my own database, seperate to vBulletin, full of information that I need.. lets say its a shopping cart as an example, basically wont something the same as this vbulletin to have like, I don't know a count of how many items are in "my" shopping cart. I hope this helps.
  7. I could, but then I'd have a million things in sessions. I also want something dynamic, so if the database changes, say more items are added, the sessions wont reflect this change.. unless set again.
  8. Hi guys, I'm just curious as to how I would go about to create a "globals.php" page much similar to the one vBulletin uses just as an example. I have some ideas but I'm not 100% sure. In my mind it works sort of like this. - Do a query to grab all relevant data for the user - Put it in an array - Take data from array .. $array['user'] (example) Could anyone tell me if I'm waaaaaaaaay off and if so offer some guidance, links perhaps? Thank you!
  9. <?PHP $file = $_GET['id']; switch ($file) { case 1: include '1.php'; break; case 2: include '2.php'; break; case default: include 'default.php'; break; } ?> Something like that?
  10. Thanks. Know any decent tutorials?
  11. I know I could do it that way. But.. Any point in using Prepared Statements? (Security wise)
  12. I swear I had read a tutorial on this site, but I must be mistaken as I can't find it. I did some googling on it.. but not to happy with the tutorials. Just wondering if someone could point me in a better direction. I'm wondering if I can take advantage of these. Like if I put these in a "config" file that is called on every PHP page and I have 2 or 3 SQL queries that I always want to run, a SELECT and UPDATE (maybe a delete). I could call these at will.. right? Without having to rewrite the query a million times? Any help is most appreciated.
  13. There is a forum dedicated to these sort of questions. You do realise this is the PHP Coding help forum, right?.. http://www.phpfreaks.com/forums/css-help/ - CSS help.
  14. As said above. Names are wrong. Keep in mind you're uploading your files to a PUBLIC forum. You should ALWAYS ALWAYS, change your usernames/passwords in files you upload. <label>Username: </label><input type="text" style="height: 1em;" size="15" name="username" required> <--! this should be username.. not password --> <br> <label>Password: </label><input type="password" style="height: 1em;" size="15" name="passWord" required>
  15. http://www.phpfreaks.com/forums/ajax-help/
  16. Not really relating to the code, but, can you wrap your CODE in the PHP tags.
  17. You could use the ITEM_ID and an SQL query. SELECT sum(qty) FROM items WHERE itemid = $_SESSION['itemid'] Or am I way off here?
  18. It's what we like to call problem solving. We can read your code to isolate (if there is any) errors in the code. If we can't see any errors than it would point to a server side issue.
  19. Got it using a different method. $xml = simplexml_load_file('http://steamcommunity.com/profiles/' . $id . '/?xml=1'); echo $xml->steamID . "<br />";
  20. I'm missing something..?
  21. You'll have to use javascript/jQuery. http://keith-wood.name/countdown.html - check that out. You'll obviously have to play around with it.
  22. Hey guys, I'm working on a little image thingy. What I want to do, is use a URL such as , Grab data from it, put the into variables and create an image with the data. I read the tutorial on this website and sort of got stuck.. with external XML files, ALSO this doesn't look like your normal XML file. Here is the code I have thus far.. I got stuck at the 'playerstats' part.. <?php $rss = new SimpleXMLElement('http://steamcommunity.com/profiles/76561197968575517/stats/L4D2/?xml=1', null, true); foreach($rss->xpath('playerstats') as $item) { echo <<<EOF <p> {$item->steamID64} <br /> {$item->hoursPlayed} </p> EOF; } ?>
  23. I think you should at least have a go at trying this yourself, google is your friend! Then if you run into any problems, post here for help. http://php.net/manual/en/image.examples-png.php - Here is an example of creating a PNG image with PHP.
  24. Also.. <form method='post' action='pay2.php'> First Name: <input type='text' name='first' value="<?php echo ($_POST['first']); ?>" <br/> Last Name: <input type='text' name='last' value="<?php echo ($_POST['last']); ?>" <br/> Hours of Work: <input type='text' name='hours' value="<?php echo ($_POST['hours']); ?>" <br/> Hourly Pay Rate: <input type='text' name='rate' value="<?php echo ($_POST['rate']); ?>" <br/> <input type='submit' value='submit'> </form> This is wrong, the VALUES should be like 'first', 'last', 'hours' etc etc..
  25. if (empty($pay) || empty($hours) || empty($extra) || empty($rate)) { echo "You have forgotten to fill something out, click the back button and try again."; exit(); } Something like this.
×
×
  • 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.