Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7808

Re: passing values into javascript

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.php
Subject Re: passing values into javascript
Date 2012-12-15 21:36 +0000
Organization A noiseless patient Spider
Message-ID <kaiqgi$voh$1@dont-email.me> (permalink)
References <14k13t3ghfii5.rtu07anokn7j$.dlg@40tude.net> <kagomk$o0$1@dont-email.me> <1c509cnlwc8ky.138l6xvqihkle$.dlg@40tude.net> <kahssi$3u7$1@dont-email.me>

Show all headers | View raw


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

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

passing values into javascript richard <noreply@example.com> - 2012-12-14 20:03 -0500
  Re: passing values into javascript Jerry Stuckle <jstucklex@attglobal.net> - 2012-12-14 21:52 -0500
    Re: passing values into javascript richard <noreply@example.com> - 2012-12-14 22:09 -0500
      Re: passing values into javascript Denis McMahon <denismfmcmahon@gmail.com> - 2012-12-15 13:10 +0000
        Re: passing values into javascript Tim Streater <timstreater@greenbee.net> - 2012-12-15 13:22 +0000
        Re: passing values into javascript Denis McMahon <denismfmcmahon@gmail.com> - 2012-12-15 21:36 +0000
    Re: passing values into javascript Allodoxaphobia <knock_yourself_out@example.net> - 2012-12-15 16:40 +0000
      Re: passing values into javascript Jerry Stuckle <jstucklex@attglobal.net> - 2012-12-15 19:22 -0500
    Re: passing values into javascript richard <noreply@example.com> - 2012-12-15 23:39 -0500
      Re: passing values into javascript "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2012-12-16 06:21 +0000
        Re: passing values into javascript Jerry Stuckle <jstucklex@attglobal.net> - 2012-12-16 09:12 -0500
          Re: passing values into javascript richard <noreply@example.com> - 2012-12-16 13:50 -0500
      Re: passing values into javascript "P E Schoen" <paul@peschoen.com> - 2012-12-19 18:30 -0500

csiph-web