NYCPHP Meetup

NYPHP.org

[nycphp-talk] Passing JAVASCRIPT variables to PHP

John Campbell jcampbell1 at gmail.com
Tue Apr 1 23:33:41 EDT 2008


On Tue, Apr 1, 2008 at 7:22 PM, Kristina Anderson
<ka at kacomputerconsulting.com> wrote:
> One of the projects I inherited recently contains the following code
>  which is used basically to store the record ID and editstate in the
>  URL's querystring.  When I first saw it, I was scratching my head
>  saying, why would anyone think they needed to do it this way?
>
>
>  <script language="javascript">
>  function jfunc(arg){
>         window.location='thissamedocument.php?id='+arg+'&edit=false';
>  }
>  </script>
>
>  and then throughout the page this script is called by echoing the
>  following:
>
>                 echo "<SCRIPT LANGUAGE='JavaScript'>\n";
>                 echo "javascript: jfunc(" . $whateverID . ")\n";
>                 echo "</script>\n";
>
>  Would love to hear any and all comments on the above vis a vis this
>  discussion.
>

My guess is the programmer didn't understand the concept of a 302 header.

-John C.



More information about the talk mailing list