View Full Version : Setting a PHP variable on submission of a form

03-24-2004, 05:55 AM
I just need to change the variable $act when the form is submitted. What am I doing wrong?


$conn=new COM('ADODB.Connection');

$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db");

if ($act=="change"){
$sql="update TestTable set Customer='$Customer' where CustomerID='1'";
else {
$sql='SELECT Customer, CustomerID, PhoneNumber FROM TestTable';

$rs=$conn-> Execute($sql);


<? while (!$rs->EOF){ ?>
<td><?= $rs->Fields['Customer']->Value ?></td>
<td><?= $rs->Fields['CustomerID']->Value ?></td>
<td><?= $rs->Fields['PhoneNumber']->Value ?></td>
<? $rs->MoveNext() ?>
<? } ?>

<form name="f" action="blendtecdb.php" method="post">
<input type="hidden" name="act" value="" >
<input type="text" name="name" value="<?=$Customer ?>">
<input type="button" value="Change the Name" onclick="change()">

function change(){





03-24-2004, 05:53 PM
Err... could you just:

if (isset($_POST['name'])) {
$act = 'blah';

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum