Search the Community
Showing results for tags 'handle'.
-
Folks, Q1. A function parameter that takes in a constant, can it always take in a variable, unless it needs a handle ? While going through the Explode function tutorial, I did not come across anything that states the 3rd parameter (explode limit) in the Explode function has to be a string or a constant. Like so: <?php //Tutorial: http://www.tizag.com/phpT/php-string-explode.php echo "Script 1"; //Using a Constant as 3rd parameter in the Explode function. Using FOR function. $phrase = "Please don't blow me to pieces."; $words = explode(" ", $phrase); print_r($words); for($i = 0; $i < count($words); $i++){ echo "Piece $i = $words[$i] <br />"; } $explode_limit = 4; $words = explode(" ", $phrase, 4); for($i = 0; $i < count($words); $i++){ echo "Limited Piece $i = $words[$i] <br />"; } print_r ($words); ?>
-
Hello, I'm here with a question that maybe silly for most of you but I just can't handle it. As I know, there's no way in built in PHP inside JS because diferent kind of languages ( Server Side and Client Side ). But I have a problem that I need help to handle. I have a multilanguage system in my site ( PHP ) and form validations ( JS ). I have the error messages showed by JS instantly, but I can only print text, not a PHP variable info. For example: $(function() { // validate signup form on keyup and submit $("#loginform").validate({ rules: { user: "required", password: "required", }, messages: { user: "Please enter your username or email.", password: "Please enter your password", } }); }); And my multilanguage system uses the following system: $lang['login_error'] = 'Incorrect details provided.'; There is any way to make something like this: $(function() { // validate signup form on keyup and submit $("#loginform").validate({ rules: { user: "required", password: "required", }, messages: { user: <?php echo $lang[login_error']; ?>, password: "Please enter your password", } }); }); I know this doesn't work, but it's to make an easy example in what I need, because depending the language the user as choosen, the error should be there in that language, not only in one language. Could you please help me to handle this ? Thanks in advance.
- 5 replies
-
- php
- javascript
-
(and 3 more)
Tagged with: