Example #1
0
echo $saldo_atual;
?>
" readonly disabled />
                    </label>
                    <label>
                        <strong>Abater saldo</strong>
                        <input type="text" name="descontar" id="descontar" />
                    </label>
                    <label>
                        <strong>Inserir crédito</strong>
                        <input type="text" name="credito" id="credito" />
                    </label>
                    <button type="submit" name="action">Enviar</button>
                </form>            
            </section>
            <footer class="footer">
                <p>&copy; Todos os direitos reservados - 2014</p>
            </footer>
        </div>
    </body>
</html>

<?php 
if (isset($_POST['action'])) {
    if (!empty($_POST['credito'])) {
        $conta->depositar($_POST['credito'], $saldo_em_conta);
    }
    if (!empty($_POST['descontar'])) {
        $conta->sacar($_POST['descontar'], $saldo_em_conta);
    }
}