#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    34
    Rep Power
    12

    Unhappy php & javascript events


    i'm trying to reload the page when the user enters a value into an input box and it's not working?

    i have...

    <input type="text" name="T1" value="<? echo $T1;?>" onChange="location.href='<?php $PHP_SELF."?SD=".$SD."&T1=".$T1; ?>';>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    UK
    Posts
    68
    Rep Power
    13
    looing at this code:

    Code:
    <input type="text" name="T1" value="<? echo $T1;?>" onChange="location.href='<?php $PHP_SELF."?SD=".$SD."&T1=".$T1; ?>';>
    you seem to have missed a " that ends the onchange even, whether this is the problem, i don't know.

    I think onblur might be a better option ?

    hope this helps
  4. #3
  5. Retired
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Finland
    Posts
    9,143
    Rep Power
    2493
    I think that Javascript and PHP work better together if you echo the whole thing out in PHP (or print).

    i.e.
    PHP Code:
    echo "<input type=\"text\" name=\"T1\" value=\"".$T1."" onChange=\"location.href='".$_SERVER['PHP_SELF']."?SD=".$SD."&amp;T1=".$T1."'\";> 
    Please note that the board is stripping some backslashes
    Last edited by jabba_29; June 12th, 2003 at 08:09 AM.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    34
    Rep Power
    12
    tried onBlur and tried stringing it all out in php but neither made any difference. thanks anyhow though!

IMN logo majestic logo threadwatch logo seochat tools logo