Jump to content

AyKay47

Members
  • Posts

    3,281
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by AyKay47

  1. AyKay47

    Using Regex

    Can you post the last solution you have tried so we can steer you in the right direction.
  2. Okay let me start from the beginning since you are not understanding basic language. In the original post, all the OP states is that he/she is validating a form by posting it to itself. Sticky input values alone are not validation. I would like the OP to post the code he is using to validate the form so I may check it, since his post was extremely brief and misled me as to how he is actually validating the form.
  3. The reason I asked that question was to make sure that the OP is validating the user input correctly.
  4. By using the selected attribute with the <option> tag. How is posting the form to itself validation?
  5. Change ([a-z/]+) to ([a-z/]+(?:\s[a-z/]+)?) this will allow an optional second word for the weather condition.
  6. drunkelf, If you would like to study further what neil is talking about, the buzz words are encapsulation and loose coupling
  7. Why do you need 2 directories? Store each file name in its own variable: $target_path = "uploads/"; $fileName1 = $_FILES['selectedfile']['name']; $fileName2 = $_FILES['selectedfile2']['name']; $target_path1 = $target_path . $fileName1; $target_path2 = $target_path . $fileName2; if(move_uploaded_file($_FILES['selectedfile']['tmp_name'], $target_path1)) { echo "The file ". $fileName1 . " has been uploaded"; } else { echo "There was an error uploading the file, please try again!"; } if(move_uploaded_file($_FILES['selectedfile2']['tmp_name'], $target_path2)) { echo "The file ". $fileName2 ." has been uploaded"; } else { echo "There was an error uploading the file, please try again!"; }
  8. Because that is what you are telling it to name the file in this line: $target_path = $target_path . basename( $_FILES['selectedfile']['name']) .basename( $_FILES['selectedfile2']['name']); In both file uploads, you are saving to the same path, therefore overwriting the first file upload.
  9. I will try to simplify this for you. These lines are of significance: $str = "hEllo WoRld!"; capitalize( $str ); echo $str; The source of the parameter sent to the function "capitalize" is $str = "hEllo WoRld!"; If the source $str was not passed to the function by reference, when you output $str it would remain "hEllo WoRld" since only a copy local to the function will be changed and not the source. However since you are passing the source to the function by reference, the source $str changes as well. In this particular case when you output $str you will get "HELLO WORLD".
  10. Please post the relevant code that you have so far.
  11. $num_arr = array(100.1111, 200.2222, 300.3333); foreach($num_arr as $number) { number_format($number, 2); } this will round every element in the array to the nearest thousandth.
  12. Not sure on your logic here. Is list() what you are looking for?
  13. Using global is never a valid solution.
  14. The above code does not show us the table structure for registrations.
  15. No, what does your table structure look like?
  16. No, you don't. However either method will work, bit of a habit for myself to use checksums since they have other advantages as well. What we can both agree on here is that relying on a submit button value may cause problems in some browsers.
  17. Or use a hidden checksum..
  18. To point you in the right direction, look into using jQuery's AJAX API
  19. In order to help you, you will need to show us the form you are using and the relevant back-end code to go along with the form.
  20. Here's a simple example for you (untested): $patterns = array('~((?:http|ftp)://(?:www)?\.[^.]+\.(?:com|org|gov))~i', '~(?<!http://)(www)\.([^.]+)\.(com|org|gov)~i'); $replace = array('<a href="$1">$1</a>', '<a href="http://$1.$2.$3">http://$1.$2.$3</a>'); $filtered_string = preg_replace($patterns, $replace, $text); The regex patterns will match 2 situations, the first will match URL's that begin with http:// or ftp:// and may possibly include www. The second will match URL's that begin with www and are not preceded by http://, it will then add http:// to the beginning of the URL to make it a valid external link.
  21. I'm having a hard time following the logic in your code, please give a detailed description of what exactly you are trying to do.
  22. http:// is needed in links so that they are external, otherwise they will point internally which is not what we want. What you can do is write another regex that looks for www and replaces it with http://www
  23. It should read htmlentities() instead of htmlentities(]
  24. Didn't see that you had already provided the correct answer, I didn't see that there was a second page to this thread. Doh! Also didn't notice the spelling. double Doh! It's early...
  25. You will need to provide a better explanation and example for us to be able to help you. The example provided is incorrect on many different levels.
×
×
  • 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.