the code below does mostly what it's supposed to do. It grabs the $id from a previous page and uses that to search the database for that ID and then shows the results. I am trying to get to where it shows the current $Name variable and then allows the user to change the name by using a form. So when the user changes the Name to a new name, the form in theory submit the new results to a new page AND also carry the $id variable over so I can go ahead and put the data into the same field. Currently only the $id is being passed over, I'm having issues with submitting the #NewName input. I tried using "hidden" input but that did not work since it is dynamic. How is it possible to send both?
<head>
<script type="text/javascript">
function SendEmail(button, db_ID) {
//document.getElementById("ImpactNotifications").submit();
window.open ('changenameto.php?db_ID='+db_ID,'newWin', 'width=600,height=200');
}
</script>
</head>
<body style="color: #black; background-color: #0000FF;">
<?php
$id = $_GET['id'];
$sql = "SELECT * FROM DBTABLE WHERE ID=$id";
$db_ID1=odbc_exec($conn,$sql);
$db_ID = odbc_result($db_ID1,1);
echo "<strong>Name:</strong>";
echo "<br />";
$rs=odbc_exec($conn,$sql);
while($row = odbc_fetch_array($rs))
{
$Name=odbc_result($rs,"Name");
echo "$Name";
echo "<br />";
echo "<form method='post' name='ChangeName' enctype='multipart/form-data'>";
echo "<br />";
echo "<strong>Name Changed To:</strong><br />";
echo "<input name='NewName' type='text' style='width: 500px; height: 24px;' />";
echo "<br />";
echo '<br /><input type="submit" name="ChangedMe" value="Name Modified" onclick="SendEmail(this, ' . $db_ID . '); return false;" /><input name="Clear" type="reset" value="Reset" /><br />';
echo "</form>";
}
?>
UPDATE
<head>
<script type="text/javascript">
function SendEmail(button, db_ID) {
document.getElementById('db_ID').value = db_ID; // inserting db_ID in hidden
document.forms['ChangeMeetingName'].submit(); // submitting form
}
</script>
</head>
<body style="color: #black; background-color: #0000FF;">
<?php
$id = $_GET['id'];
$sql = "SELECT * FROM DBTABLE WHERE ID=$id";
$db_ID1=odbc_exec($conn,$sql);
$db_ID = odbc_result($db_ID1,1);
echo "<strong>Name:</strong>";
echo "<br />";
$rs=odbc_exec($conn,$sql);
while($row = odbc_fetch_array($rs))
{
$Name=odbc_result($rs,"Name");
echo "$Name";
echo "<br />";
echo "<form action='changenameto.php' method='post' name='ChangeName' enctype='multipart/form-data'>";
echo "<br />";
echo "<input name='db_ID' id='db_ID' type='hidden' value='' />";
echo "<strong>Name Changed To:</strong><br />";
echo "<input name='NewName' type='text' style='width: 500px; height: 24px;' />";
echo "<br />";
echo '<br /><input type="submit" name="ChangedMe" value="Name Modified" /><input name="Clear" type="reset" value="Reset" /><br />';
echo "</form>";
}
?>