How to call session_start?

0

How to set up a form of PagSeguro in a session_start for my shopping cart; This is my code:

<h1>Confirmar Pedidos</h1>
<table width="569" border="0">
  <tr>
    <td colspan="4" align="center" valign="middle" bgcolor="#000000" style="color: #FFF">LISTA DE PRODUTOS COMPRADOS</td>
  </tr>
  <tr>

    <td width="150" align="center" valign="middle" bgcolor="#FF9933">NOME</td>
    <td width="162" align="center" valign="middle" bgcolor="#FF9933">PREÇO</td>
    <td width="105" align="center" valign="middle" bgcolor="#FF9933">QUANTIDADE</td>
    <td align="center" valign="middle" bgcolor="#FF9933">SUB-TOTAL</td>
  </tr>
<?php


  session_start();
  $meucarrinho = $_SESSION['carrinho'];
  if(isset($meucarrinho)){

      $total = 0;

    for($i=0; $i < count($meucarrinho); $i++){

        if ($meucarrinho[$i]<>NULL){


?>
  <tr>

    <td align="center" valign="middle" bgcolor="#0066CC"><?php echo $meucarrinho[$i] ['nome'] ?></td>
    <td align="center" valign="middle" bgcolor="#0066CC"><?php echo $meucarrinho[$i] ['preco'] ?></td>
    <td align="center" valign="middle" bgcolor="#0066CC"><?php echo $meucarrinho[$i] ['quantidade'] ?></td>

<?php
    $subtotal = $meucarrinho[$i] ['preco'] * $meucarrinho[$i] ['quantidade'];
    $total    = $total + $subtotal;
?>
    <td align="center" valign="middle" bgcolor="#0066CC"><?php echo $subtotal  ?></td>
  </tr>
<?php 
    }
   }
 }
?>

  <tr>
    <td colspan="3" align="right" bgcolor="#0066CC">TOTAL</td>
    <td align="center" valign="middle" bgcolor="#0066CC"><?php if (isset($total)) echo  $total ?></td>
  </tr>
  <tr align="center" valign="middle">
    <td height="24" bgcolor="#0066CC"></td>
    <td bgcolor="#0066CC"></td>
    <td align="left" bgcolor="#0066CC"><form name="form1" method="post" action="">

    </form></td>
    <td bgcolor="#0066CC"></td>
  </tr>
</table>
<form name="form2" method="post" action="finalizarPedidos.php">
  <table width="568" border="0">
    <tr>
      <td colspan="2" align="center" valign="middle" bgcolor="#000000" style="color:#FFF">Dados do Comprador</td>
    </tr>
    <tr>
      <td width="151" bgcolor="#0066CC">&nbsp;</td>
      <td width="407" bgcolor="#0066CC">&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#0066CC">Nome </td>
      <td bgcolor="#0066CC"><label for="nome"></label>
        <label for="nome"></label>
      <input type="text" style="text-align:left" name="nome" id="nome"></td>
    </tr>
    <tr>
      <td bgcolor="#0066CC">Email</td>
      <td bgcolor="#0066CC"><label for="email"></label>
        <label for="email"></label>
      <input type="text" style="text-align:left" name="email" id="email"></td>
    </tr>
    <tr>
      <td bgcolor="#0066CC">Endereço</td>
      <td bgcolor="#0066CC"><label for="endereco"></label>
        <label for="endereco"></label>
      <input type="text" style="text-align:left" name="endereco" id="endereco"></td>
    </tr>
    <tr>
      <td bgcolor="#0066CC">Telefone</td>
      <td bgcolor="#0066CC"><label for="telefone"></label>
        <label for="telefone"></label>
      <input type="text" style="text-align:left" name="telefone" id="telefone"></td>
    </tr>
    <tr>
      <td bgcolor="#0066CC">&nbsp;</td>
      <td bgcolor="#0066CC">&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#0066CC">&nbsp;</td>
      <td bgcolor="#0066CC"><input type="submit" name="Comprar" id="Comprar" value="Comprar"></td>
    </tr>
  </table>
</form>



 <!-- INICIO FORMULARIO BOTAO PAGSEGURO -->
  <form target="pagseguro" method="post" action="https://pagseguro.uol.com.br/checkout/checkout.jhtml">
  <input type="hidden" name="email_cobranca" value="" />
  <input type="hidden" name="tipo" value="CBR" />
  <input type="hidden" name="moeda" value="BRL" />
  <input type="hidden" name="item_id" value="" />
  <input type="hidden" name="item_descr" value="" />
  <input type="hidden" name="item_quant" value="" />
  <input type="hidden" name="item_valor" value="" />
  <input type="hidden" name="frete" value="0" />
  <input type="hidden" name="peso" value="0" />
  <input type="image" src="https://p.simg.uol.com.br/out/pagseguro/i/botoes/pagamentos/120x53-pagar.gif"name="submit" alt="Pague com PagSeguro - é rápido,    grátis e seguro!" />
</form>-->
<!-- FINAL FORMULARIO BOTAO PAGSEGURO -->

<p>&nbsp;</p>
</body>
</html>
    
asked by anonymous 25.08.2015 / 19:46

0 answers