2 Replies - 2788 Views - Last Post: 14 May 2012 - 01:15 AM Rate Topic: -----

#1 Kewne   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 10-May 12

Passing js variable to php variable on the same page

Posted 14 May 2012 - 12:44 AM

ammm...I have this code



    <table border="1" name="myTable" id="myTable">
    <?php 
    $nRow = $_GET['rowLength'];
    $nColumn = 7;
    for($i=0;$i<$nRow;$i++){
    	echo "<TR>";
    	for($i=0;$i<$nColumn;$i++){
    		echo "<TD><INPUT TYPE='text' NAME='' VALUE=''/></TD>";
    	}
    	echo "</TR>";
    }?>
    </table>




now, I'm trying to pass js variable to php variable on the same page....
but I'm having this error: Undefined index: rowLength

...I'm using $_GET to get the variable rowLength from js...

This post has been edited by Dormilich: 14 May 2012 - 01:03 AM
Reason for edit:: please use [code] [/code] tags when posting code


Is This A Good Question/Topic? 0
  • +

Replies To: Passing js variable to php variable on the same page

#2 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4214
  • View blog
  • Posts: 13,317
  • Joined: 08-June 10

Re: Passing js variable to php variable on the same page

Posted 14 May 2012 - 01:05 AM

you canít pass a variable from JS to PHP because JS is a client-side language and PHP is a server-side language. the only possibility to pass something from JS to PHP is via a HTTP request.
Was This Post Helpful? 1
  • +
  • -

#3 Kewne   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 10-May 12

Re: Passing js variable to php variable on the same page

Posted 14 May 2012 - 01:15 AM

thank you for the reply Dormilich,.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1