#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    columbia
    Posts
    2
    Rep Power
    0
    Hi listers.

    I have the next code:

    <FORM>
    <CENTER><H3>DATABAE </H3></CENTER>
    <script language="Javascript">
    function go1(form)
    {
    var tU = new Array();
    tU[0]="new_university.phtml?identi='$login'" ;
    tU[1]="nuevo_sector.phtml";

    location = tU[form.sel_URL.selectedIndex];
    }
    </script>
    &nbsp;&nbsp;
    <B>Insertar</B><BR>
    <SELECT NAME="sel_URL" onChange="go1(this.form)">
    <OPTION Value="new_university.phtml?identi='$login'">University
    </Select>
    <INPUT TYPE="Button" VALUE="IR" onClick="go1(this.form)" > <!-- via JavaScript -->
    </Form>
    Before this code I have a variable named $login. When i Ask about this variable before or after javascript thereisnīt problem because have the value. But in the javascript its value is empty. I need send this value to the page new_university.

    Thank you
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    7
    Rep Power
    0
    The problem is that JavaScript is not able to access PHP's variables all by itself. You need to go into PHP mode within your javascript and echo/print the variable's value to javascript, like this:

    tU[0]="new_university.phtml?identi='<?php echo $login; ?>'" ;
  4. #3
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    Perth West Australia
    Posts
    757
    Rep Power
    15
    try,

    tU[0]="new_university.phtml?identi=<? echo $login?>" ;

    and elsewhere in yor code, to javascript $login is exactly that $login not whatever it contains.

    ------------------
    Simon Wheeler
    FirePages -DHTML/PHP/MySQL

Similar Threads

  1. PHP scripts to run in Javascript continuously
    By linhardt in forum JavaScript Development
    Replies: 0
    Last Post: February 13th, 2004, 02:51 PM
  2. pass php value of a varible to javascript variable
    By fluke_tony in forum JavaScript Development
    Replies: 1
    Last Post: February 13th, 2004, 03:34 AM
  3. PHP w/ Javascript - Mozilla adds </script> cuts off my code
    By aikoto in forum JavaScript Development
    Replies: 2
    Last Post: February 8th, 2004, 12:58 PM
  4. javascript inside php tags
    By andy123 in forum JavaScript Development
    Replies: 5
    Last Post: February 5th, 2004, 04:34 PM
  5. Get a Javascript variable into PHP, again
    By fchausson in forum JavaScript Development
    Replies: 2
    Last Post: February 5th, 2004, 09:55 AM

IMN logo majestic logo threadwatch logo seochat tools logo