Hi
I want to understand how to pass any variable betwen functions with PHP. Could anyone make it easy for me to understand please as I want the 'id' field? basically I have a list of records an a click to edit button. This brings up the editor. All works except for the WHERE statement whih does not get the $idDetails value.

<?php function showroweditor($row)
{
global $idDetails;
$idDetails=$row["id"];
echo $idDetails; //this works
?>
<center>
<table class="tbl" border="0" cellspacing="1" cellpadding="5"width="50%">
<tr>
<td><? echo htmlspecialchars("REF")."&nbsp;" ?></td>
<td class="dr"><input type="text" name="id" maxlength="30" value="<? echo str_replace('"', '&quot;', trim($row["id"])) ?>"></td></tr>
</table>
}


<? function editrec($recid)
{
global $idDetails;

<form action="garant.php" method="post">
<input type="hidden" name="sql" value="update">
<input type="hidden" name="xid" value="<? echo $row["id"] >">
<? showroweditor($row) ?>
<p><input type="submit" name="action" value="POST"></p>
</TABLE>
</form>

function sql_update()
{
global $idDetails;
$sql = "update `Garant` set
`id`=" .sqlvalue(@$_POST["id"], true) ."
where id = '$idDetails' ";
}

Hope that you understand. Thanks in advance for anyone's time and effort.

$idDetails = $_POST; can get this from the form after submit

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.