2 Replies - 914 Views - Last Post: 03 August 2012 - 08:56 AM

#1 badrbarca  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 05-April 12

Problem with recovery of a variable in (document.getelementbyid inner)

Posted 02 August 2012 - 06:02 AM

in my code i want to recovery a variable from an other page to use it in my request here is my code
page1.php
<script type="text/javascript">
function myFunction()
{
	var Variable = document.getElementById('id_re').value;
     mywindow = window.open('page2.php?var='+ Variable, "fenetre1");
}
</script>
<form action="" method="post">
<table cellspacing="35px" align="center">
<tr>
<td>id : </td><td><input type="text" name="id_re" value="<?php echo $row_users['id_reclamation']?>"></td>
</tr>
</table>



page2.php
<script type="text/javascript">	
	function displayResult()
	{
		var variable = location.search.substr("?var=".length);
		document.getElementById("result").innerHTML = variable;
	}
</script>
<body onload="displayResult()">
<div id="result"></div>



it display the id but i want to recovery it in a variable
i have tried
<input type="text" id="result">
but it display nothing, please help i'm stuck

Is This A Good Question/Topic? 0
  • +

Replies To: Problem with recovery of a variable in (document.getelementbyid inner)

#2 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3710
  • View blog
  • Posts: 5,958
  • Joined: 08-June 10

Re: Problem with recovery of a variable in (document.getelementbyid inner)

Posted 02 August 2012 - 06:45 AM

View Postbadrbarca, on 02 August 2012 - 01:02 PM, said:

it display the id but i want to recovery it in a variable

What do you mean "recover it in a variable"?

You already have the value in the variable inside the displayResult function. What is it, exactly, that you want to do with the value?
Was This Post Helpful? 0
  • +
  • -

#3 badrbarca  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 05-April 12

Re: Problem with recovery of a variable in (document.getelementbyid inner)

Posted 03 August 2012 - 08:56 AM

View PostAtli, on 02 August 2012 - 06:45 AM, said:

View Postbadrbarca, on 02 August 2012 - 01:02 PM, said:

it display the id but i want to recovery it in a variable

What do you mean "recover it in a variable"?

You already have the value in the variable inside the displayResult function. What is it, exactly, that you want to do with the value?

thank you for answered, i have the value of the variable in a 'ID' i can display it just in a <div> or <a>, i want to put it in an input value to store it in a variable and insert it in BD.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1