/    Sign up×
Community /Pin to ProfileBookmark

Using getElementById()

Hey gurus, I have a php form (form A) that when I click some button, it opens a popup window which is also a php page (form ?. In the popup I enter some values and want to submit these values to form B.

I have tried document.getElementById() method while at form A to read form B hidden value id but i dont get any results. Is it possible to achieve this? Please assist.

Mutua

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@tirnaFeb 01.2011 — Post the code you have so far and we can try to help you get it working.
Copy linkTweet thisAlerts:
@kakinyimauthorFeb 02.2011 — Tirna,

My code goes here ===>


I have pasted the codes here. regAssignUser.php opens a popup files.php and then files.php close() to end data to regAssignUser.php

=================================

<!-- regAsignUser.php -->
====================================


<?php session_start(); ?>

<script type="text/javascript">

function open_files()

{

var mySearch = document.getElementById("idFile");

if(mySearch.value == ""){

alert("You Have Not Entered Anything");

}else{

window.open('files.php?myList='+mySearch.value,'myExample','width=600,height=700,modal=yes, scrollbars=yes, location=no');

}

}

</script>

<script type="text/javascript">

function readValue()

{

var XX = document.getElementById("myFileNoX");

alert(XX.value);

}

</script>

<?php

.

.

.

others codes goes down here

===========================================

<!-- file.php -->
========================================


<?php session_start(); ?>

<html>

<head>

</head>

<body>

<?php $txtFile = $_GET['myList']; ?>

<script type="text/javascript">

function submitForm()

{

document.forward.submit()

close();

}

</script>

<script type="text/javascript">

function closeNull()

{

close();

}

</script>

<?php

include_once('./Connections/myconn.php');

$db = mysql_select_db('registryis', $myconn);

if (!$db) {// if the database is not available

$message = " There was a problem in trying to connect to the database.Please try later after sometime";

mysql_error();

exit;

}

$result = @mysql_query("select * from file where fileTitle like '&#37;$txtFile%' or fileNo like '%$txtFile%';");

if (!$result) {

exit('<p> Error performing query: ' . mysql_error() . '</p>');

}

$num = mysql_num_rows($result);

if ($num == 0) {

?>

<table width="75%" border="1" align="left" bgcolor="#CC99CC">

<tr>

<td><div align="center" class="style1">Your Search Found No File(s) <BR>

<input type=button onClick="closeNull()" value='Close Window'> </div> </td>

</tr>

</table>

<?php } else { ?>

<table width="75%" border="1" align="center" bgcolor="#CC99CC" >

<FORM NAME="forward" ACTION="regAssignUser.php" />

<tr>

<td width="196"><strong>File Number</strong></td>

<?php do { ?>

<td><?php echo $row_qry['fileNo']; ?> </td>

<?php $fileNo = $row_qry['fileNo']; ?>

<input type="hidden" name="myFileNo" id="myFileNoX" value = <?php echo $fileNo; ?> />

<td><input type="radio" name="radSelect" value="Select" onClick ="submitForm()" /> </td>

</tr>

<?php } while ($row_qry = mysql_fetch_array($result)); } ?>

</form>

</table>

</body>

</html>
×

Success!

Help @kakinyim spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...