AyKay47
-
Posts
3,281 -
Joined
-
Last visited
-
Days Won
1
Posts posted by AyKay47
-
-
Still have no idea what you mean. What "page" a user points to in order to perform the validation has no bearing on the actual validation - or the topic being discussed. And his query seemed perfectly self explanatory to me.
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.
-
He didn't mean that the act of posting a form to itself is validation. But, he is posting the form back to itself because that is where he put the validation logic. This is a common practice so that when validation fails you can easily redisplay the form and, like in this case, make the form values "sticky" so the user's previous input will populate the fields. This is so the user doesn't have to enter all of the data back into a form because one field was invalid.
The reason I asked that question was to make sure that the OP is validating the user input correctly.
-
By using the selected attribute with the <option> tag. How is posting the form to itself validation?
-
Change
([a-z/]+)
to
([a-z/]+(?:\s[a-z/]+)?)
this will allow an optional second word for the weather condition.
-
drunkelf, If you would like to study further what neil is talking about, the buzz words are encapsulation and loose coupling
-
hi all eventually created second directory on server called uploads2 and created new path? I guess which works. Code below. Happy enough, all I have to do is look in two different folders instead of one which isnt a biggie. Thanks loads for responses all, code below..
$target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['selectedfile']['name']); if(move_uploaded_file($_FILES['selectedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['selectedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } $target_path = "uploads2/"; $target_path = $target_path . basename( $_FILES['selectedfile2']['name']); if(move_uploaded_file($_FILES['selectedfile2']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['selectedfile2']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; }
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!"; }
-
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.
-
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".
-
Please post the relevant code that you have so far.
-
$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.
-
Not sure on your logic here. Is list() what you are looking for?
-
That's true, and we can add globals to the list as well. However, those are poor solutions. For a small project, I would store an array in a file like Andy-H does in his example. For bigger projects, I would store it in a database and cache it on the web server. For large projects, I would do neither and look into using a framework.
Using global is never a valid solution.
-
The above code does not show us the table structure for registrations.
-
so i must create a new table for date in my database ? then put that code in register.php ?
No, what does your table structure look like?
-
You really don't need to go to the bother of using a hidden checksum simply to prevent undefined index notices.
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.
-
Or use a hidden checksum..
-
To point you in the right direction, look into using jQuery's AJAX API
-
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.
-
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.
-
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.
-
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
-
It should read htmlentities() instead of htmlentities(]
-
There is definitely an echo in here!
AyKay, you might want to recheck the spelling in Jessica's quote
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...
-
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.
Using Regex
in Regex Help
Posted
Can you post the last solution you have tried so we can steer you in the right direction.