Jump to content

MFHJoe

Members
  • Posts

    91
  • Joined

  • Last visited

    Never

Everything posted by MFHJoe

  1. I just did a quick test and: mb_convert_case($string, MB_CASE_TITLE, "UTF-8"); Appears to work. You may have to chage the UTF-8 to the encoding of your page (although it will probably work anyway).
  2. I'm not sure if I understand the question, but try downloading osDate again and instead of uploading the whole program, just upload the lang_main.php file.
  3. Just to close this completely, the reason it wasn't working in TransmorgiBenno's script was because the echo statement was in single quotes which don't allow interpret variables (like $name). If you had changed the echo statement to double quotes, his script would have worked. Your way works well too though . Joe
  4. ini_set('display_errors', 'Off'); At the top of your PHP file may do the trick, providing your webhost allows you to use that command (some don't).
  5. <?php // If the form has been submitted... if(isset($_POST['load'])) { // Set $name as the value of the name field in your form ($_POST just references the form) $pet = $_POST['pet']; echo $pet; } // If the form hasn't been submitted yet... else { // Display the form echo '<form method="post"> <select name="pet" tabindex="2"> <option>---Select---</option> <option value="1">dog</option> <option value="2">cat</option> </select> <input name="load" type="submit" value="Load record" /> </form>'; } ?> Should do the trick. Let me know if you need any more help with how that code works.
  6. Or $_REQUEST['username'][1]. The reason for posting my message above was to figure out which one, but I suppose guessing would be quicker. Just increment the number until you get the value you're looking for.
  7. I'm guessing $contentowner is the one that's not working properly. Run the code below with your form and post the output (I commented out the mySQL bit as we don't need that at the minute). I added a print_r statement that prints an array out in a readable way. You can use it to determine which part of the username array you want to use. <?php $contenttype = $_POST['contenttype']; $contentid = $_POST['contentid']; $contentname = $_POST['contentname']; $contentowner = $_POST['username']; // I added this. print_r($contentowner); /* $insert = 'INSERT INTO content (ContentOwner, ContentID, ContentType, ContentName) VALUES ("'.$contentowner.'", "'.$contentid.'", "'.$contenttype.'", "'.$contentname.'")'; mysql_query($insert) or die(mysql_error()); */ ?>
  8. <?php // If the form has been submitted... if(isset($_POST['submit'])) { // Set $name as the value of the name field in your form ($_POST just references the form) $name = $_POST['name']; echo $name; } // If the form hasn't been submitted yet... else { // Display the form echo '<form name="form" method="post"> <input type="text" name="name" size="27" /> <input type="submit" name="submit" value="Go"> </form>'; } ?> The above code would probably be the most basic way of doing it. If you want it to be done automatically without the user pressing submit then it gets a bit more confusing as you have to use Ajax as well. Let me know if you need that code explained any more. I'd be happy to help.
  9. Are you sending any headers with the mail? If so, what are they? If they're wrong they can sometimes make weird things happen. It seems strange that it was working and now it's not though... Do you know if anything has been changed on your server?
  10. To upload a file in PHP you need enctype="multipart/form-data" in your <form> tag. Not sure if this will solve your problem but it definitely needs to be there. <form method="POST" action="upload.php" enctype="multipart/form-data">
  11. Probably not. When games like this are coded one of the main things to do is put code on the server to stop people doing this. The game you're trying to cheat on looks pretty professional - they will have done it. Unlucky.
  12. Chances are, changing the source code (locally) isn't going to do anything anyway...
  13. I know it would be something like that -- cheers, both.
  14. Hi I'm trying to make an OOP system and it's not working the way I want it to. I've not had too much experience with OOP in PHP so it might be something obvious that's breaking it. I have 3 files: parent.php <?php class c_parent { function __construct() { include('child.php'); echo 'constructed<br />'; } function test_parent() { echo 'parent working<br />'; } } $parent = new c_parent; ?> child.php <?php class c_child extends c_parent { function test_child() { echo 'child working<br />'; } } ?> init.php <?php include('parent.php'); $parent->test_parent(); $parent->test_child(); ?> What I was hoping to achieve is being able to access every function from the child classes from the parent class variable, however I get the following feedback upon running init.php: This shows that the constructor class has run and the child class has been included, but the function from inside the child class still can't be used. What's the reason for this? Have I got the wrong idea of what I can do with PHP? Or is there another way to go about this? Cheers Joe
  15. Hi, I'm thinking about starting off a simple PHP framework using OOP which I can use in my applications. I want the structure to be something like this: - index.php (uses the framework) - framework - core.php (decides which framework files to include and grabs the config) - library - errors.php (the error handler) - database.php (the database handler) - forms.php (the form handler) - config - defaults.php (holds the default config) - config.php (hold the user-defined config) The thing is, I need everything to link in with each other, ie. I need to use the error class on it's own, as well as in the database handler and the form handler. All files also need to be able to use the config. Early tests show that I can't do this. Any ideas?
×
×
  • 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.