cakephp - Code to convert in Cake Php -


I want to write this code with the KPHP conference Please help. This is my main php code. goes. In Step 1 the customer details and form are redirected to step 2, adds a product here and then the data is saved in the invoice and the product table. Not all codes, but if some clues are made available, then how to move it into actions, get $ step and take action on it

this is add.php

 < Code> & lt; Include "Inc / functions.php"; If (! $ _ Session ['log']) {header ("location: login /"); } $ Meniu = 'add'; $ Step = 1; If (isset ($ _GET ['step'])) {$ step = $ _ GET ['step']; } If (isset ($ _ POST ['step1'])) {if ($ _ POST ['client_name'] == '') {$ err ['client_name'] = 'error'; } And {$ _SESSION ['command'] ['client_name'] = $ _ POST ['client_name']; $ _SESSION ['order'] ['client_email'] = $ _ post ['client_email']; $ _SESSION ['order'] ['client_phone'] = $ _ post ['client_phone']; $ _SESSION ['order'] ['client_address'] = $ _ post ['client_address']; $ _SESSION ['order'] ['client_location'] = $ _ post ['client_location']; $ _SESSION ['order'] ['PAYMENT_METHOD'] = $ _ post ['PAYMENT_METHOD']; Header ("location: add.php? Phase = 2"); }} If (($ _ POST ['step2']) {mysql_query ("invoice (client_name, client_email, client_phone, client_address, client_location, payment_metho D, VAT, total, currency, date) values ​​(". Order '] [' client_name '].' '$ _ Session [' order '] [' client_mail '].' ',' ". $ _ Session ['order'] ['client_phone']" ',' ". $ _ Session ['order'] ['client_address']. "', '". $ _ Session [' order '] [' client_location ']. "', '". $ _ Session [' command '] [' PAYMENT_METHOD ']. "$ Cfg [' VAT ']."', '". $ _ Session [' total_order ']."', '". $ Cfg [' currency '].' ', '') Time (). "') Or die (mysql_error ()." 1 "); $ Id = mysql_insert_id (); (" title, description, quantity, value , Taxes, invoices) ($. $ '[[Title \]'] $ ($ "$ [s] ['product'] as $ tag = & gt; $ val) {mysql_query." ',' '.Val [' description ']. "', '". $ Val [' quantity ']. "', '". $ Val [' price '].' ',' ". $ Val [ ''. '', '. $ Id.' ') "Or die (mysql_error ()." 2 ");} unset ($ _ session [' product '], $ _ session [' command '] ); $ _SESSION ['invoice'] = $ id; Header ("location: add.php? Phase = 3"); }? & Gt; & Lt; Body & gt; & Lt; Div id = 'container' & gt; By & lt;? Included "inc / header.php"? & Gt; & Lt; Div class = 'title' & gt; New invoice & lt; / Div & gt; & Lt; Div id = 'step' & gt; & Lt; Table alignment = 'center' & gt; & Lt; TR & gt; & Lt; Td square = 'step & lt;? If ($ step == 1) {& gt; Current  1) {& gt; Have done  & Lt; Td square = 'step & lt;? If ($ step == 2) {& gt; Current  2) {& gt; Have done  & Lt; Td square = 'step & lt;? If ($ step == 3) {& gt; Current  3) {& gt; Have done  

You need an invoice model that An attached controller with your invoice table, a invoice method that will secure data from your invoice model Look at your database and see a invoice / add that contains the form to add an invoice.

The login part is very simple and it is done almost magically.

To better understand, please do a blog tutorial; You will understand the key part of KPPHP:


Comments