I made a capture of fields of the comic and gives this error

Asked

Viewed 50 times

-1

After I put this code below ....

         $capturaValorTotal = $_POST['valor'];
         $capturaValorPagar = $_POST['valor-pagar'];

         $valorDevido = $capturaValorTotal - $capturaValorPagar;

         $inserindoBanco = "INSERT INTO `clientes` (`saldoDevedor`) VALUES ('".$valorDevido."')";

         $executandoQuery = mysql_query($inserindoBanco);

Happened these mistakes below ...

PHP Error was encountered

Severity: Notice

Message: Undefined index: valor-pagar

Filename: controllers/financial.php

Line Number: 355 PHP Error was encountered

Severity: Warning

Message: Cannot Modify header information - headers already sent by (output Started at /home/molu/public_html/ossystem/system/core/Exceptions.php:185)

Filename: Libraries/Session.php

Line Number: 675 PHP Error was encountered

Severity: Warning

Message: Cannot Modify header information - headers already sent by (output Started at /home/molu/public_html/ossystem/system/core/Exceptions.php:185)

Filename: helpers/url_helper.php

Line Number: 542

Remembering that it is a system made in codeigniter, with POO. All the fields cited above were inserted in the database. In Models I selected the fields I need (if necessary, I put here tbm Models.)

My intention is just to make a change to the system, so that when the user receives part of a payment, the system registers the "missing" in the balance field.

I hope I can explain my doubt.

  • Put var_dump($_POST) at the beginning of your code, and see if the "value-pay" key actually exists.

  • If you are using the pq codeigniter you are using $_POST direct? should use the class input. Not to mention obsolete function mysql_query()

  • rray, I am a beginner in PHP. I am starting and I have this system known MAP OS (the one of Orders of Service). Since I’m short of cash, and I need to make these urgent changes, I have to get my hand on the code. But I don’t know much about codeigniter, although I’m enjoying it. If you could refer me to some website or codeigniter course I’d appreciate it. But how would I input this problem? Is $this->db->input-post the same as _$POST()? I had researched but could not find the answer or could not understand this question!

  • William Novak, I put the var_dump and generated this error:

  • The PHP Error was encountered Severity: Notice Message: Undefined index: value-pay Filename: controllers/financial.php Line Number: 355 NULL The PHP Error was encountered Severity: Warning Message: Cannot Modify header information - headers already sent by (output Started at /home/molu/public_html/ossystem/system/core/Exceptions.php:185) Filename: Libraries/Session.php Line Number: 675

  • But in the VIEW there is the value-pay field, which is na for (for="value-pay"). Now what I don’t understand is: if the view has this field, how will I "declare" here in the controller.

  • Even following the RRAY tip, I made $this->input->post('value'); and $this->input->post('value-pay');, replacing _$POST(). Although that pile of error did not appear any more, but became all white screen (what worried me more). And in the bank nothing was recorded... tipow.. that "contained" result that should be recorded in the bank, was not recorded. I will post the code again....

  • $capturValorTotal => $this->input->post('value'); $capturValorPagar => $this->input->post('value-pay'); $valueDeved = $capturValueTotal - $capturValuePagar; $insertionBanco = "INSERT INTO clientes set saldoDevedor='".$valueValue." '"; $executandoQuery = mysql_query($insertionBanco);

Show 3 more comments

1 answer

1

I see some problems there

1)exchange your Insert line for this

$inserindoBanco = "INSERT INTO `clientes` set `saldoDevedor`='".valorDevido."'";

2) value payable is not defined

3) you are doing some information output before some header or this setting 2 headers on the same page. It would be interesting for you to make the whole Cod available for verification.

  • Jasar Orion. Tbm I made this change, but nothing was recorded in the bank. There on "valueDevido." I put the $ and still did not work out.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.