Jump to content

using PHP value in JS


esandra

Recommended Posts

i'm trying to get the value of variable $y that loops up to 100

My problem is that it's in PHP and it's below my JS...

here is my JS , what i'm trying to do with this script is to total

a couple of textboxes onChange..

this is within a <head></head>

 

function autototal() {

var y = form1.y.value

document.write(y);

for(x =1; x <= y; x++) {

var txtarr = form1.arrastre + y.value;

var txtwhar = form1.wharfage + y.value;

 

var totam = (txtarr-0) + (txtwhar-0)

form1.total + y.value = totam;

}

}

 

///////////////////////////////////////

here is my php loop , how i get $y

this is inside <body></body>

 

 

$num=100;

$nump=$num / 10;

$y=1;

for($j=1;$j<=$nump;$j++){

for($i=1;$i<=10;$i++){

//some textboxes and text

echo $y;

}

$y=$y;

}

 

now how do i get the value of $y so I could make my JS work?

thank you for your time

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.