Jump to content

HuggieBear

Members
  • Posts

    1,899
  • Joined

  • Last visited

Everything posted by HuggieBear

  1. If you look through the code you'll see references to fopen() throughout it, that's where it opens the file. The first parameter that function accepts is the path to the file.  So search for fopen() in your script and change the path of the file to the correct directory. If you need further help then let me know and I can show you what needs changing, but have a go at it yourself first. Regards Huggie
  2. The code you've got is correct, to count the number of elements in an array then just use count(). [code=php:0]$total = count($_SESSION['quickpick']);[/code] Or did you mean you want the total of all the elements in an array added together? Regards Huggie
  3. I achieved it with the minimum of headers... [code]<?php // Email details $to = "myemailaddress@hotmail.co.uk"; $from = "email@mydomain.co.uk"; $subject = "Header Testing"; $body = "Test to see if this goes into the junk folder in Hotmail or not"; // Headers $headers  = "From: " . $from . "\n"; $headers .= "Content-type: text/plain"; // Send mail if (mail($to, $subject, $body, $headers)){   echo "Success\n"; } else {   echo "Failed\n"; }[/code] Regards Huggie
  4. [quote author=drifter link=topic=119563.msg489800#msg489800 date=1166728445] do not forget to check how users enter dates - you may also find mktime() usefull [/quote] It's coming from the database in this instance, so should be fine, but good point. Regards Huggie
  5. OK, if that worked it's because your old server had register_globals switched on, and the new one has it switched off. This will affect any php code you've moved that uses the old register globals feature. Don't forget to mark the topic as solved by using the 'Solved' button at the bottom of the page. Regards Huggie
  6. I think if you just send an email using the standard [i]to[/i], [i]subject[/i] and [i]body[/i] then Hotmail moves it to the Junk folder.  I've had a few problems with that, however, once I added some optional headers, including [i]from[/i] it seemed to get through OK. Regards Huggie
  7. It doesn't have to be an IP address, it could be a hostname. To find the IP address you could ping the hostname and the IP address will be returned, but this isn't really a PHP issue. Regards Huggie
  8. It's as simple as this... [code=php:0]foreach ($_SESSION['quicklist'] as $value){   echo $value . "<br>\n"; }[/code] This will echo all values from the $_SESSION['quicklist'] array out.  If you just want to see what's in there, you could always just dump it out using print_r(), [code=php:0]print_r($_SESSION['quicklist']);[/code] or alternatively, if you want to find out about the data types too, then use var_dump(). [code=php:0]var_dump($_SESSION['quicklist']);[/code] Regards Huggie
  9. Your update syntax is incorrect, it should be in the following format... [code=php:0]UPDATE table_name SET column_name = 'value' WHERE column_name = 'condition'[/code] So your code should be... [code=php:0]UPDATE myquiz SET qtwo = '$qtwo' WHERE id = {$_SESSION['id']}[/code] Regards Huggie
  10. HuggieBear

    hey

    This isn't PHP it's JavaScript and should be posted in the forum for [url=http://www.phpfreaks.com/forums/index.php/board,6.0.html]Javascript[/url] Regards Huggie
  11. Is [code=php:0]$_SESSION['id'][/code] a number? Can we also see a bit more of the code? Regards Huggie
  12. It looks as though the mail extension is all installed and pointing to the right place on that server. Try not to post large blocks of text like that, it's not very pleasing on the eye ;) Regards Huggie
  13. No, the provided code does what you want it too. It doesn't put anything in as the value on the first display of the form, but once you've filled the fields in and submitted, the default values will be set to what you put in the fields. Regards Huggie
  14. I think [url=http://uk.php.net/manual/en/function.eval.php]eval()[/url] is what you're looking for... Regards Huggie
  15. OK, that's the POST method, in that case try this piece of code... [code]<?php foreach ($_POST as $k => $v){   $$k = $v; } if ($send=="yes") {   $to = "email@address.co.uk";   $subject = "$subjectVar";   $body .= "$msgVar";   $from = "$nameVar";   $tfrom = "From: <$emailVar>";   mail($to,$subjectVar,$msgVar,$tfrom); } echo "&errormessage=Email has been sent&"; ?>[/code] Regards Huggie
  16. No problem, don't forget to mark this topic as solved using the new 'Solved' button. Regards Huggie
  17. If you create a file that looks like this: [code]<?php phpinfo(); ?>[/code] Upload it to your server and run it, you'll be given all the information about the php installation. Regards Huggie
  18. This looks like a register globals issue. Are you using the POST or the GET method to submit the form? Regards Huggie
  19. Try this: [code]<html> <head> </head> <body> <form action="testing1.php" method="post"> <input type="text" name="text1" value="Your Name"><br/> <input type="text" name="text2" value="0"><br/> <input type="text" name="email" value-"E-Mail Address"><br/> <input type="submit" name="submit" value="submit"><br/> </form> <?php if (isset($_POST['submit'])){   $email = $_POST['email'];   $name = $_POST['text1'];   $number = $_POST['text2'];   // check e-mail address   // display success or failure message   if (!preg_match("/^([a-zA-Z])+/",$_POST['text1']))   {       echo("Text Only As Your Name, Please Re-Submit");   }   if (!preg_match("/^([0-9])+/",$_POST['text2']))   {       echo("Invalid Number Scheme");   }   if (!preg_match("/^([a-zA-Z0-9])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/", $_POST['email']))   {       echo("Invalid e-mail address");   }   echo "Valid e-mail address, processing..."; } ?> </body> </html>[/code] Regards Huggie
  20. No problem, don't forget to use the 'Solved' button on your post. Regards Huggie
  21. If you're form had two fields, [i]username[/i] and [i]realname[/i] and I submitted the form with my details (HuggieBear and Richard) then PHP would get the following variables: [code=php:0]$_POST['username'] $_POST['realname'][/code] If you want a these to be variables with the same name as the key, then do this... [code]<?php foreach($_POST as $key => $value)      $$key = $value; ?>[/code] This means that if I want to echo Richard I can type [code=php:0]echo $realname;[/code] not [code=php:0]echo $$key;[/code] The above code has created variables with the names of the keys of the $_POST array. Regards Huggie
  22. Sounds as though it's a timestamp field, change the column type to datetime. Taken from the MySQL Manual... [quote] The first TIMESTAMP column in table row automatically is updated to the current timestamp when the value of any other column in the row is changed...[/quote] Regards Huggie
  23. You could try looking at the COM object. http://uk.php.net/manual/en/ref.com.php Regards Huggie
  24. OK, looking at the code, I'm going to guess that this line... [code=php:0]<?php virtual('/nimatest/Connections/nimatest.php'); ?>[/code] Is including that file as that's where it's expecting the database connection code to be.  If you've removed that line from the code then that's why it's not working. It's implying that you should have a separate file somewhere called nimatest.php with all your db connection code in it.  Do you have this file? Huggie
  25. Do you mean in a database? If so, then this should work... [code]SELECT count(column_name) FROM table_name WHERE column_name LIKE '%.%';[/code] Regards Huggie
×
×
  • 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.