Jump to content

How to pass values from a form to another page.


Recommended Posts

Hello, i have this custom module that i am creating its a button that when clicked a form pop up that the user must input 

name

email

address

phone number

and a submit button that redirects the client to a page saying successful, i managed to connect the database but i can not pass the values inputed to the other form so they can be saved in database.

 

The code of the form is this: 

 

    <form method="post" class="dsorder_form" action="http://localhost/PrestaShop/modules/balfinbuyinoneclick/success/test.php" autocomplete="on">
        <fieldset>
            <div class="clearfix">
                <div class="aladini-titull">
                    <h4>Porosia e thjeshtuar  me nje klik nga Aladini</h4>
                </div>
                <div class="form-group bon_order_box">
                    <label for="bon_order_name">{l s='Emri' mod='balfinbuyinoneclick'}: <sup>*</sup><p>(Kush do marre porosine)</p></label>
                    <input class="form-control" type="text" id="bon_order_name" name="bon_order_name" value="{$bon_order_name|escape:'html':'UTF-8'}"/>
                </div>
                <div class="form-group bon_order_box">
                    <label for="bon_order_address">{l s='Adresa Email' mod='balfinbuyinoneclick'}:<p>(Adresa ku do dergojme faturen)</p></label>
                    <input class="form-control" type="text" id="bon_order_address" name="bon_order_address" value="{$bon_order_address|escape:'html':'UTF-8'}"/>
                </div>
                <div class="form-group bon_order_box">
                    <label for="bon_order_city">{l s='Adresa' mod='balfinbuyinoneclick'}:  <p>(Ku do ju sjellim produktin) &nbsp;&nbsp;<i style="font-style:italic;"><sup>*</sup>Transporti 100 Leke ne Tirane dhe 250 leke ne Rrethe per pako deri 5 kg</i></p>
                    </label>
                    <input class="form-control" type="text" id="bon_order_city" name="bon_order_city" value="{$bon_order_city|escape:'html':'UTF-8'}"/>
                </div>
                <div class="form-group bon_order_box">
                    <label for="bon_order_phone">{l s='Numer telefoni' mod='balfinbuyinoneclick'}: <sup>*</sup><p>(Ku do ju telefonojme per te dorezuar produktin)</p></label>
                    <input class="form-control" type="text" id="bon_order_phone"  name="bon_order_phone" value="{$bon_order_phone|escape:'html':'UTF-8'}" autocomplete="off"/>
                </div>
                <p class="ds_name_not_filled_errors alert alert-danger">
                    {l s='Ju lutem plotesoni emrin.' mod='balfinbuyinoneclick'}
                </p>
                <p class="ds_phone_not_filled_errors alert alert-danger">
                    {l s='Ju lutem plotesoni numrin.' mod='balfinbuyinoneclick'}
                </p>
                <p class="ds_order_errors alert alert-danger">
                    {l s='Ju lutem kontrolloni fushat.' mod='balfinbuyinoneclick'}
                </p>
                <p class="ds_order_success alert alert-success">
                    {l s='Faleminderit!Ju do te njoftoheni me nje telefonate.' mod='balfinbuyinoneclick'}
                </p>
                <p class="ds_phone_validation_errors alert alert-danger">
                    {l s='Ju lutem vendosni nje numer te vlefshem.Numri duhet te jete ne nje prej formateve 355/042/38/06x-xx-xx-xxx' mod='balfinbuyinoneclick'}
                </p>
            </div>
            <div class="submit">
                <input type="hidden" name="bon_order_id_product" value="{$bon_order_id_product|escape:'html':'UTF-8'}" />
                <input type="submit" class="btn btn-default button button-small dsorder_send" value="{l s='Dergo' mod='balfinbuyinoneclick'}"/>
            </div>
            <div class="aladini-magjik">
                <p>Shpjegim: Kjo eshte nje metode e thjeshtuar porosie me pagesen ne dorezim. Stoku nuk rezervohet dhe kuponat nuk mund te perdoren.</p>
            </div>
        </fieldset>
    </form>

 

and this is the code of the other page

<?php

$con = mysqli_connect('localhost', 'root', '', 'prestashop');

if ($con) {

  echo 'connected';

} else {

  echo 'not connected';

}



$emri = $_REQUEST['bon_order_name'];

echo $emri;

die();

?>

<p>POROSIA U KRYE ME SUKSES!</p>

<?php

header('refresh: 3; url=http://localhost/PrestaShop/');

?>   

I am new in prestashop i would appreciate if you would share any resource from internet how to build moduls because i couldnt find any. 

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...