Jump to content

Cant Get my Button to work!!..please help me...


gsanghera

Recommended Posts

ok, i am a utter and total newbie

I'm trying to display some data which works, and have one box (auth_no) where the person can enter data to update to the database.

 

 

I'm hacking code, dont know PHP too much,

 

If i could get some help it would be appreciated.

 

here is what i have

 

basically they come to this screen from another screen based on the Id from where they were. here they will see a list of arranged payments. each payment needs to have an authorization entered and updated on the date of the payment. i cant get my button to work or update to the DB

 

DB is MYSQL

i also get teh follwoing error on the browser page

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\tcs\auth_no11.php:10) in C:\xampp\htdocs\tcs\auth_no11.php on line 24

 

CODE BELOW

 

<HTML>

<HEAD>

<meta http-equiv="Content-Language" content="en-us">

<TITLE>This is Example</TITLE></HEAD>

<body>

            <TABLE style="BORDER-COLLAPSE: collapse" borderColor=#77a7ad 

            cellSpacing=1 cellPadding=1 width="100%" bgColor=#ffffff border=1>

        <tr>

            <td width="37" align="center" ><font face="Tahoma" size="2"><b>STT</b></font></td>

            <td align="center" ><font face="Tahoma" size="2"><b>Payment ID</b></font></td>

<td align="center" ><font face="Tahoma" size="2"><b>debtor_id</b></font></td>

<td align="center" ><font face="Tahoma" size="2"><b>Type</b></font></td>

<td align="center" ><font face="Tahoma" size="2"><b>Payment_date</b></font></td> 

<td align="center" ><font face="Tahoma" size="2"><b>Fee</b></font></td>

<td align="center" ><font face="Tahoma" size="2"><b>Nsf</b></font></td>

<td align="center" ><font face="Tahoma" size="2"><b>Payment_Amount</b></font></td> 

<td align="center" ><font face="Tahoma" size="2"><b>Total Payment</b></font></td> 

<td align="center" ><font face="Tahoma" size="2"><b>Auth_no</b></font></td>

                    </tr>

 

 

<?

include_once("config.php");

session_start();

$userinfo=$_SESSION;

if($userinfo['islogged'] & $userinfo['accesslevel'] >= 10){

$todo=$_POST['todo'];

if(isset($_GET['id'])){

$id=$_GET['id'];

}elseif(isset($_POST['id'])){

$id=$_POST['id'];

}

}

 

 

 

 

$update=$_POST['update'];

$query="select id,debtor_id,type,payment_date,fees,nsf,payment_amount, total_payment,auth_no from tcs_process where debtor_id='$id' and verified=0 order by payment_date ";

$result=mysql_query($query);

if($array=mysql_fetch_assoc($result)){

$debtor_id=$id;

$payment_id=$array['id'];

$type=$array['type'];

$payment_date=$array['payment_date'];

$fees=$array['fees'];

$nsf=$array['nsf'];

$payment_amount=$array['payment_amount'];

$total_payment=$array['total_payment'];

$auth_no=$_POST['auth_no'];

 

 

$search_id=$array['id'];

if($_POST['mod_user']=="Update"){

$debtor_id=$id;

$payment_id=$array['paymentid'];

$type=$array['type'];

$payment_date=$array['payment_date'];

$fees=$array['fees'];

$nsf=$array['nsf'];

$payment_amount=$array['payment_amount'];

$total_payment=$array['total_payment'];

$auth_no=$_POST['auth_no'];

$update_query="UPDATE tcs_process SET auth_no='$auth_no' where paymentid='$payment_id'";

$update_result=mysql_query($update_query) or die(mysql_error());

$error_code="Updated Information";

}

}

 

 

 

 

 

{

 

    $stt=0;

    while($row=mysql_fetch_array($result))

    {

        $stt++;

?>

        <tr>

            <td width="37" align="center"><font face="Tahoma" size="2"><?=$stt?></font></td>

            <td align="center"><font face="Tahoma" size="2"><?=$row["id"]?></font></td>

<td align="center"><font face="Tahoma" size="2"><?=$row["debtor_id"]?></font></td>

<td align="center"><font face="Tahoma" size="2"><?=$row["type"]?></font></td>

<td align="cener"><font face="Tahoma" size="2"><?=$row["payment_date"]?></font></td>

<td align="center"><font face="Tahoma" size="2"><?=$row["fees"]?></font></td>

<td align="center"><font face="Tahoma" size="2"><?=$row["nsf"]?></font></td>

<td align="center"><font face="Tahoma" size="2"><?=$row["payment_amount"]?></font></td>

<td align="center"><font face="Tahoma" size="2"><?=$row["total_payment"]?></font></td>

<td><label><input name="auth_no" type="text" size="20" /></label></td>

<td><label><?

          if($search_name=='newuser'){

print "<input type='submit' name='mod_user' id='mod_user' value='Add'>";

}else{

print "<input type='submit' name='mod_user' id='mod_user' value='Update'";

}   ?>

        </tr>

        <?

    }

}

?>

    </table>

</body>

</html>

 

Link to comment
Share on other sites

Session_start(); has to be on the first line of your page.

 

<?php session_start(); ?>
<HTML> 
<HEAD> 
<meta http-equiv="Content-Language" content="en-us"> 
<TITLE>This is Example</TITLE></HEAD> 
<body> 
            <TABLE style="BORDER-COLLAPSE: collapse" borderColor=#77a7ad  
            cellSpacing=1 cellPadding=1 width="100%" bgColor=#ffffff border=1> 
        <tr> 
            <td width="37" align="center" ><font face="Tahoma" size="2">STT</font></td> 
            <td align="center" ><font face="Tahoma" size="2">Payment ID</font></td> 
         <td align="center" ><font face="Tahoma" size="2">debtor_id</font></td> 
         <td align="center" ><font face="Tahoma" size="2">Type</font></td> 
         <td align="center" ><font face="Tahoma" size="2">Payment_date</font></td>   
         <td align="center" ><font face="Tahoma" size="2">Fee</font></td>
         <td align="center" ><font face="Tahoma" size="2">Nsf</font></td>
         <td align="center" ><font face="Tahoma" size="2">Payment_Amount</font></td>  
         <td align="center" ><font face="Tahoma" size="2">Total Payment</font></td>  
          <td align="center" ><font face="Tahoma" size="2">Auth_no</font></td> 
                    </tr> 
               

<? 
include_once("config.php");
$userinfo=$_SESSION;
if($userinfo['islogged'] & $userinfo['accesslevel'] >= 10){
   $todo=$_POST['todo'];
   if(isset($_GET['id'])){
      $id=$_GET['id'];
   }elseif(isset($_POST['id'])){
      $id=$_POST['id'];
}
}      
      
      
      
      
   $update=$_POST['update'];
   $query="select id,debtor_id,type,payment_date,fees,nsf,payment_amount, total_payment,auth_no from tcs_process where debtor_id='$id' and verified=0 order by payment_date ";
   $result=mysql_query($query);
   if($array=mysql_fetch_assoc($result)){
      $debtor_id=$id;
      $payment_id=$array['id'];
      $type=$array['type'];
      $payment_date=$array['payment_date'];
      $fees=$array['fees'];
      $nsf=$array['nsf'];
      $payment_amount=$array['payment_amount'];
      $total_payment=$array['total_payment'];
      $auth_no=$_POST['auth_no'];
      

      $search_id=$array['id'];
   if($_POST['mod_user']=="Update"){
      $debtor_id=$id;
   $payment_id=$array['paymentid'];
   $type=$array['type'];
   $payment_date=$array['payment_date'];
   $fees=$array['fees'];
      $nsf=$array['nsf'];
   $payment_amount=$array['payment_amount'];
      $total_payment=$array['total_payment'];
   $auth_no=$_POST['auth_no'];
      $update_query="UPDATE tcs_process SET auth_no='$auth_no' where paymentid='$payment_id'";
      $update_result=mysql_query($update_query) or die(mysql_error());
      $error_code="Updated Information";
   }   
      }
      
      
      
      
      
{ 

    $stt=0; 
    while($row=mysql_fetch_array($result)) 
    { 
        $stt++; 
?> 
        <tr> 
            <td width="37" align="center"><font face="Tahoma" size="2"><?=$stt?></font></td> 
            <td align="center"><font face="Tahoma" size="2"><?=$row["id"]?></font></td>
         <td align="center"><font face="Tahoma" size="2"><?=$row["debtor_id"]?></font></td> 
         <td align="center"><font face="Tahoma" size="2"><?=$row["type"]?></font></td> 
         <td align="cener"><font face="Tahoma" size="2"><?=$row["payment_date"]?></font></td>    
         <td align="center"><font face="Tahoma" size="2"><?=$row["fees"]?></font></td>
         <td align="center"><font face="Tahoma" size="2"><?=$row["nsf"]?></font></td>
         <td align="center"><font face="Tahoma" size="2"><?=$row["payment_amount"]?></font></td> 
         <td align="center"><font face="Tahoma" size="2"><?=$row["total_payment"]?></font></td> 
         <td><label><input name="auth_no" type="text" size="20" /></label></td>      
<td><label><?
             if($search_name=='newuser'){
            print "<input type='submit' name='mod_user' id='mod_user' value='Add'>";
         }else{
            print "<input type='submit' name='mod_user' id='mod_user' value='Update'";
                     }        ?>
        </tr> 
        <? 
    } 
}
?> 
    </table> 
</body> 
</html>

Link to comment
Share on other sites

Try

 

<?php session_start(); ?>
<HTML> 
<HEAD> 
<meta http-equiv="Content-Language" content="en-us"> 
<TITLE>This is Example</TITLE></HEAD> 
<body> 
            <TABLE style="BORDER-COLLAPSE: collapse" borderColor=#77a7ad  
            cellSpacing=1 cellPadding=1 width="100%" bgColor=#ffffff border=1> 
        <tr> 
            <td width="37" align="center" ><font face="Tahoma" size="2">STT</font></td> 
            <td align="center" ><font face="Tahoma" size="2">Payment ID</font></td> 
         <td align="center" ><font face="Tahoma" size="2">debtor_id</font></td> 
         <td align="center" ><font face="Tahoma" size="2">Type</font></td> 
         <td align="center" ><font face="Tahoma" size="2">Payment_date</font></td>   
         <td align="center" ><font face="Tahoma" size="2">Fee</font></td>
         <td align="center" ><font face="Tahoma" size="2">Nsf</font></td>
         <td align="center" ><font face="Tahoma" size="2">Payment_Amount</font></td>  
         <td align="center" ><font face="Tahoma" size="2">Total Payment</font></td>  
          <td align="center" ><font face="Tahoma" size="2">Auth_no</font></td> 
                    </tr> 
               

<?php
include_once("config.php");
$userinfo=$_SESSION;
if($userinfo['islogged'] & $userinfo['accesslevel'] >= 10){
   $todo=$_POST['todo'];
   if(isset($_GET['id'])){
      $id=$_GET['id'];
   }elseif(isset($_POST['id'])){
      $id=$_POST['id'];
}
}      
      
      
      
      
   $update=$_POST['update'];
   $query="select id,debtor_id,type,payment_date,fees,nsf,payment_amount, total_payment,auth_no from tcs_process where debtor_id='$id' and verified=0 order by payment_date ";
   $result=mysql_query($query);
   if($array=mysql_fetch_assoc($result)){
      $debtor_id=$id;
      $payment_id=$array['id'];
      $type=$array['type'];
      $payment_date=$array['payment_date'];
      $fees=$array['fees'];
      $nsf=$array['nsf'];
      $payment_amount=$array['payment_amount'];
      $total_payment=$array['total_payment'];
      $auth_no=$_POST['auth_no'];
      

      $search_id=$array['id'];
   if(isset($_POST['mod_user'])){
      $debtor_id=$id;
   $payment_id=$array['paymentid'];
   $type=$array['type'];
   $payment_date=$array['payment_date'];
   $fees=$array['fees'];
      $nsf=$array['nsf'];
   $payment_amount=$array['payment_amount'];
      $total_payment=$array['total_payment'];
   $auth_no=$_POST['auth_no'];
      $update_query="UPDATE tcs_process SET auth_no='$auth_no' where paymentid='$payment_id'";
      $update_result=mysql_query($update_query) or die(mysql_error());
      $error_code="Updated Information";
   }   
      }
      
      
      
      
      
{ 

    $stt=0; 
    while($row=mysql_fetch_array($result)) 
    { 
        $stt++; 
?> 
        <tr> 
            <td width="37" align="center"><font face="Tahoma" size="2"><?=$stt?></font></td> 
            <td align="center"><font face="Tahoma" size="2"><?=$row["id"]?></font></td>
         <td align="center"><font face="Tahoma" size="2"><?=$row["debtor_id"]?></font></td> 
         <td align="center"><font face="Tahoma" size="2"><?=$row["type"]?></font></td> 
         <td align="cener"><font face="Tahoma" size="2"><?=$row["payment_date"]?></font></td>    
         <td align="center"><font face="Tahoma" size="2"><?=$row["fees"]?></font></td>
         <td align="center"><font face="Tahoma" size="2"><?=$row["nsf"]?></font></td>
         <td align="center"><font face="Tahoma" size="2"><?=$row["payment_amount"]?></font></td> 
         <td align="center"><font face="Tahoma" size="2"><?=$row["total_payment"]?></font></td> 
         <td><label><input name="auth_no" type="text" size="20" /></label></td>      
<td><label><?
             if($search_name=='newuser'){
            print "<input type='submit' name='mod_user' id='mod_user' value='Add'>";
         }else{
            print "<input type='submit' name='mod_user' id='mod_user' value='Update'";
                     }        ?>
        </tr> 
        <? 
    } 
}
?> 

Link to comment
Share on other sites

Its because you forgot ">" for your button.

 

Try

 

<?php session_start(); ?>
<HTML> 
<HEAD> 
<meta http-equiv="Content-Language" content="en-us"> 
<TITLE>This is Example</TITLE></HEAD> 
<body> 
            <TABLE style="BORDER-COLLAPSE: collapse" borderColor=#77a7ad  
            cellSpacing=1 cellPadding=1 width="100%" bgColor=#ffffff border=1> 
        <tr> 
            <td width="37" align="center" ><font face="Tahoma" size="2">STT</font></td> 
            <td align="center" ><font face="Tahoma" size="2">Payment ID</font></td> 
         <td align="center" ><font face="Tahoma" size="2">debtor_id</font></td> 
         <td align="center" ><font face="Tahoma" size="2">Type</font></td> 
         <td align="center" ><font face="Tahoma" size="2">Payment_date</font></td>   
         <td align="center" ><font face="Tahoma" size="2">Fee</font></td>
         <td align="center" ><font face="Tahoma" size="2">Nsf</font></td>
         <td align="center" ><font face="Tahoma" size="2">Payment_Amount</font></td>  
         <td align="center" ><font face="Tahoma" size="2">Total Payment</font></td>  
          <td align="center" ><font face="Tahoma" size="2">Auth_no</font></td> 
                    </tr> 
               

<?php
include_once("config.php");
$userinfo=$_SESSION;
if($userinfo['islogged'] & $userinfo['accesslevel'] >= 10){
   $todo=$_POST['todo'];
   if(isset($_GET['id'])){
      $id=$_GET['id'];
   }elseif(isset($_POST['id'])){
      $id=$_POST['id'];
}
}      
      
      
      
      
   $update=$_POST['update'];
   $query="select id,debtor_id,type,payment_date,fees,nsf,payment_amount, total_payment,auth_no from tcs_process where debtor_id='$id' and verified=0 order by payment_date ";
   $result=mysql_query($query);
   if($array=mysql_fetch_assoc($result)){
      $debtor_id=$id;
      $payment_id=$array['id'];
      $type=$array['type'];
      $payment_date=$array['payment_date'];
      $fees=$array['fees'];
      $nsf=$array['nsf'];
      $payment_amount=$array['payment_amount'];
      $total_payment=$array['total_payment'];
      $auth_no=$_POST['auth_no'];
      

      $search_id=$array['id'];
   if(isset($_POST['mod_user'])){
      $debtor_id=$id;
   $payment_id=$array['paymentid'];
   $type=$array['type'];
   $payment_date=$array['payment_date'];
   $fees=$array['fees'];
      $nsf=$array['nsf'];
   $payment_amount=$array['payment_amount'];
      $total_payment=$array['total_payment'];
   $auth_no=$_POST['auth_no'];
      $update_query="UPDATE tcs_process SET auth_no='$auth_no' where paymentid='$payment_id'";
      $update_result=mysql_query($update_query) or die(mysql_error());
      $error_code="Updated Information";
   }   
      }
      
      
      
      
      
{ 

    $stt=0; 
    while($row=mysql_fetch_array($result)) 
    { 
        $stt++; 
?> 
        <tr> 
            <td width="37" align="center"><font face="Tahoma" size="2"><?=$stt?></font></td> 
            <td align="center"><font face="Tahoma" size="2"><?=$row["id"]?></font></td>
         <td align="center"><font face="Tahoma" size="2"><?=$row["debtor_id"]?></font></td> 
         <td align="center"><font face="Tahoma" size="2"><?=$row["type"]?></font></td> 
         <td align="cener"><font face="Tahoma" size="2"><?=$row["payment_date"]?></font></td>    
         <td align="center"><font face="Tahoma" size="2"><?=$row["fees"]?></font></td>
         <td align="center"><font face="Tahoma" size="2"><?=$row["nsf"]?></font></td>
         <td align="center"><font face="Tahoma" size="2"><?=$row["payment_amount"]?></font></td> 
         <td align="center"><font face="Tahoma" size="2"><?=$row["total_payment"]?></font></td> 
         <td><label><input name="auth_no" type="text" size="20" /></label></td>      
<td><label><?php
             if($search_name=='newuser'){
            print "<input type='submit' name='mod_user' id='mod_user' value='Add'>";
         }else{
            print "<input type='submit' name='mod_user' id='mod_user' value='Update'>";
                     }        ?>
        </tr> 
        <? 
    } 
}
?> 

Link to comment
Share on other sites

You need a FORM and /FORM tags in order to submit something.  This tells it what method to use and what action to take.

 

Replace <? with <?php

 

i dont undersatnd what you mean by where is the form.

also what should i replace the ?> and <? with?

 

thanks again

Link to comment
Share on other sites

Thanks all for your help. thanks for the link jesirose i'll se what i can do.

 

the code now reads.. as follows the button does something, but cant get the data to update now usimg the query..

 

$update_query="UPDATE tcs_process SET auth_no='$auth_no' WHERE id='$payment_id'";

 

 

 

<? session_start();?>

<HTML>

<HEAD>

<meta http-equiv="Content-Language" content="en-us">

<TITLE>This is Example</TITLE></HEAD>

<body>

<?php

 

if(isset($_GET['id'])){

$id=$_GET['id'];

}elseif(isset($_POST['id'])){

$id=$_POST['id'];

}

?>

<form method="post" action="auth_no11.php?id=<?php echo $id ?>">

            <TABLE style="BORDER-COLLAPSE: collapse" borderColor=#77a7ad 

            cellSpacing=1 cellPadding=1 width="100%" bgColor=#ffffff border=1>

        <tr>

            <td width="37" align="center" ><font face="Tahoma" size="2"><b>STT</b></font></td>

            <td align="center" ><font face="Tahoma" size="2"><b>Payment ID</b></font></td>

<td align="center" ><font face="Tahoma" size="2"><b>debtor_id</b></font></td>

<td align="center" ><font face="Tahoma" size="2"><b>Type</b></font></td>

<td align="center" ><font face="Tahoma" size="2"><b>Payment_date</b></font></td> 

<td align="center" ><font face="Tahoma" size="2"><b>Fee</b></font></td>

<td align="center" ><font face="Tahoma" size="2"><b>Nsf</b></font></td>

<td align="center" ><font face="Tahoma" size="2"><b>Payment_Amount</b></font></td> 

<td align="center" ><font face="Tahoma" size="2"><b>Total Payment</b></font></td> 

<td align="center" ><font face="Tahoma" size="2"><b>Auth_no</b></font></td>

                    </tr>

 

 

<?

include_once("config.php");

 

$userinfo=$_SESSION;

if($userinfo['islogged'] & $userinfo['accesslevel'] >= 10){

$todo=$_POST['todo'];

if(isset($_GET['id'])){

$id=$_GET['id'];

}elseif(isset($_POST['id'])){

$id=$_POST['id'];

}

}

 

 

 

 

$update=$_POST['update'];

$query="select id,debtor_id,type,payment_date,fees,nsf,payment_amount, total_payment,auth_no from tcs_process where debtor_id='$id' and verified=0 order by payment_date ";

$result=mysql_query($query);

if($array=mysql_fetch_assoc($result)){

$debtor_id=$id;

$payment_id=$array['paymentid'];

$type=$array['type'];

$payment_date=$array['payment_date'];

$fees=$array['fees'];

$nsf=$array['nsf'];

$payment_amount=$array['payment_amount'];

$total_payment=$array['total_payment'];

$auth_no=$_POST['auth_no'];

 

 

$search_id=$array['id'];

if($_POST['mod_user']=="Update"){

$debtor_id=$id;

$payment_id=$array['paymentid'];

$type=$array['type'];

$payment_date=$array['payment_date'];

$fees=$array['fees'];

$nsf=$array['nsf'];

$payment_amount=$array['payment_amount'];

$total_payment=$array['total_payment'];

$auth_no=$_POST['auth_no'];

echo $auth_no;

$update_query="UPDATE tcs_process SET auth_no='$auth_no' WHERE id='$payment_id'";

echo $update_query . "<br />";

$update_result=mysql_query($update_query) or die(mysql_error());

$error_code="Updated Information";

}

}

 

 

 

 

 

{

 

    $stt=0;

    while($row=mysql_fetch_array($result))

    {

        $stt++;

?>

        <tr>

            <td width="37" align="center"><font face="Tahoma" size="2"><?=$stt?></font></td>

            <td align="center"><font face="Tahoma" size="2"><?=$row["id"]?></font></td>

<td align="center"><font face="Tahoma" size="2"><?=$row["debtor_id"]?></font></td>

<td align="center"><font face="Tahoma" size="2"><?=$row["type"]?></font></td>

<td align="cener"><font face="Tahoma" size="2"><?=$row["payment_date"]?></font></td>

<td align="center"><font face="Tahoma" size="2"><?=$row["fees"]?></font></td>

<td align="center"><font face="Tahoma" size="2"><?=$row["nsf"]?></font></td>

<td align="center"><font face="Tahoma" size="2"><?=$row["payment_amount"]?></font></td>

<td align="center"><font face="Tahoma" size="2"><?=$row["total_payment"]?></font></td>

<td><label><input name="auth_no" type="text" size="20" /></label></td>

<td><label><?

          if($search_name=='newuser'){

print "<input type='submit' name='mod_user' id='mod_user' value='Add'>";

}else{

print "<input type='submit' name='mod_user' id='mod_user' value='Update'";

}   ?>

        </tr>

        <?

    }

}

?>

    </table>

</form>

</body>

</html>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.