FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » passing values into javascript
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: passing values into javascript [message #179876 is a reply to message #179873] Sat, 15 December 2012 21:36 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On Sat, 15 Dec 2012 13:10:42 +0000, Denis McMahon wrote:

> $myval1 = 50; // default value if ( isset( $_GET['myval1'] ) &&
> preg_match( '/^[2-7][0-9]$/', $_GET ['myval1'] ) == 1 ) {
> $myval1 = intval( $_GET['myval1'] );
> if ( $myval1 < 25 ) $myval1 = 25; // lower limit value if ( $myval1 > 75
> )
> $myval1 = 75; // upper limit value }

Typical ballsed up wrapping ...

$myval1 = 50; // default value

// check if a get value was received and that it has the expected
// text format

if ( isset( $_GET['myval1'] ) && preg_match( '/^[2-7][0-9]$/', $_GET
['myval1'] ) == 1 ) {

$myval1 = intval( $_GET[ 'myval1' ] ); // get the int value

if ( $myval1 < 25 ) $myval1 = 25; // lower limit value

if ( $myval1 > 75 ) $myval1 = 75; // upper limit value

}

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: HP syntax error, unexpected T_variable
Next Topic: Using echo to run separate PHP script from HTML
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 14:13:17 GMT 2024

Total time taken to generate the page: 0.04332 seconds