skip to Main Content

I am trying to get to use the to integrate with PHP, however when i press the button, nothing happens. I am using the same tags and arguments as i am using on another .php file which works fine, also if i on the same php file add standalone with the button, without the content, it works. So i suspect some of the content is bugging this. Anyone knows a solution?

Here is my code that is relevant:

            <form class="form-wizard" method="post">                    
            <div class="steps-progress">
                <div class="progress-indicator"></div>
            </div>
            
            <ul>
                <li class="active">
                    <a href="#tab2-1" data-toggle="tab"><span>1</span>Kontakt informasjon</a>
                </li>
                <li>
                    <a href="#tab2-2" data-toggle="tab"><span>2</span>Innehaver</a>
                </li>
                <li>
                    <a href="#tab2-3" data-toggle="tab"><span>3</span>Egenerklæring</a>
                </li>
                <li>
                    <a href="#tab2-4" data-toggle="tab"><span>4</span>Betaling</a>
                </li>
            </ul>
            
            <div class="tab-content">
                <div class="tab-pane active" id="tab2-1">
                    
                    <div class="row">
                        
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="control-label" for="tw_fullname">Fullnavn</label>
                                <input type="text" class="form-control" name="tw_fullname" id="tw_fullname" data-validate="required" value="<?php echo $db_firstname." ".$db_lastname;?>" placeholder="Skriv inn fullnavn til kontakt person" disabled/>
                            </div>
                        </div>
                        
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="control-label" for="tw_email">E-post adresse</label>
                                <input type="email" class="form-control" name="tw_email" id="tw_email" data-validate="required" value="<?php echo $db_email;?>" placeholder="Skriv inn e-post adresse til kontakt person" disabled/>
                            </div>
                        </div>
                        
                    </div>
                    
                    <div class="row">
                        
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="control-label" for="tw_postaladdress">Postadresse</label>
                                <input type="text" class="form-control" name="tw_postaladdress" id="tw_postaladdress" data-validate="required" value="<?php echo $db_address1;?>" placeholder="Skriv inn adressen til kontakt person" />
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="control-label" for="tw_postalzip">Postkode</label>
                                <input type="text" pattern="[0-9]" class="form-control" name="tw_postalzip" id="tw_postalzip" data-validate="required" value="<?php echo $db_postal_code;?>" placeholder="Skriv inn postkoden til kontakt person" />
                            </div>
                        </div>
        
                    </div>
                    
                </div>
                
                <div class="tab-pane" id="tab2-2">
                    
                    <div class="row">
                        
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="control-label" for="tw_innehaverfullname">Innehavers Fullnavn</label>
                                <input type="text" class="form-control" name="tw_innehaverfullname" id="tw_innehaverfullname" data-validate="required" value="<?php echo $db_firstname." ".$db_lastname;;?>" placeholder="Skriv inn fullnavnet til innehaver" disabled/>
                            </div>
                        </div>
                        
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="control-label" for="tw_innehaveremail">Innehavers E-post Adresse</label>
                                <input type="email" class="form-control" name="tw_innehaveremail" id="tw_innehaveremail" data-validate="required" value="<?php echo $db_email;?>" placeholder="Skriv inn e-post adressen til innehaver" disabled/>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="form-group">
                                <label class="control-label" for="tw_innehaverphone">Innehavers Telefon Nummer</label>
                                <input type="phone" class="form-control" name="tw_innehaverphone" id="tw_innehaverphone" data-validate="required" value="<?php echo $db_phone_no;?>" placeholder="Skriv inn telefon nummer til innehaver" disabled/>
                            </div>
                        </div>
                        
                    </div>
                    
                    <div class="row">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="control-label" for="tw_innehaverpid">PID-Nummer</label>
                                <input type="text" class="form-control" name="tw_innehaverpid" id="tw_innehaverpid" value="<?php echo $db_norid_pid;?>" placeholder="Skriv inn PID-Nummer dersom det gjelder privatperson" disabled/>
                            </div>
                        </div>

                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="control-label" for="tw_innehaverorgnr">Org.nr</label>
                                <input type="text" class="form-control" name="tw_innehaverorgnr" id="tw_innehaverorgnr" value="<?php echo $db_business_number;?>" placeholder="Skriv inn organisasjonsnummer dersom det gjelder bedrift" />
                            </div>
                        </div>
                        
                    </div>
                    
                </div>

                <div class="tab-pane" id="tab2-3">
                    
                    <div class="row">
                        <div class="col-sm-5">
                            
                            <input type="file" class="form-control file2 inline btn btn-primary" name="tw_noriddeclaration" id="tw_noriddeclaration" data-label="<i class='glyphicon glyphicon-file'></i> Last opp egenerklæring" />
                            
                        </div>
                    </div>

                    
                </div>
                
                <div class="tab-pane" id="tab2-4">
                    <h3><strong>Bestillingsoversikt</strong></h3>
                    <p>Dette er en oversikt over hva du er i ferd med å bestille hos oss. Vennligst gå gjennom hele ordren for feil før du trykker bestill. Når bestilling er sendt inn er den bindende.</p>
                    <table class="table table-bordered table-striped datatable" id="table-2">
                        <thead>
                            <tr>
                                <th>Tjeneste</th>
                                <th>Beskrivelse</th>
                                <th>Pris</th>
                                <th>Varighet</th>
                            </tr>
                        </thead>
                        
                        <tbody>
                        <tr>
                            <td>Domenenavn</td>
                            <td><?php echo $domainName;?></td>
                            <td>Kr 4,99 NOK /første året</td>
                            <td>1 år</td>
                        </tr>
                        </tbody>
                    </table><br>

                    <h3><strong>Betalingsmetode</strong></h3>
                    <p>Velg betalingsmetoden du ønsker å benytte for å gjennomføre bestillingen.</p>
                        
                    <div class="radio radio-replace">
                        <input type="radio" id="rd-1" name="radio1" checked>
                        <label><strong>Faktura (kreditt)</strong> - Fungerer kun dersom du ble innvilget kreditt hos oss, kredittvurdering kan bli gjennomført.</label>
                    </div>
                    
                    <div class="radio radio-replace">
                        <input type="radio" id="rd-2" name="radio1">
                        <label><strong>Faktura (forhåndsbetalt)</strong> - Tjenesten aktiveres når fakturaen er betalt.</label>
                    </div>
                    
                    <div class="radio radio-replace">
                        <input type="radio" id="rd-3" name="radio1" disabled>
                        <label><strong>VISA</strong></label>
                    </div>
                    
                    <div class="radio radio-replace">
                        <input type="radio" id="rd-4" name="radio1" disabled>
                        <label><strong>Mastercard</strong></label>
                    </div>
                    <button type="submit" class="btn btn-info" name="checkout_complete">Utfør bestilling</button>
                    

                    <!--<input type="submit" class="btn btn-info"value="Utfør bestilling" name="checkout_complete">-->
                    <!--<form method="POST">-->
                    <!--</form>-->
                </div>
            </div>
        </form>
        <!-- end Checkout form-->

and the very simple PHP side of the code which does nothing except confirming if the form works, which it doesn’t because nothing happens when i press the submit button:

if(isset($_POST['checkout_complete'])) {
    die("DEBUG: ".$_POST["tw_email"]);
  }
}

Also, it’s not the tag that’s the issue, because as you can see in the code, i also tried which didn’t work:

                <input type="submit" class="btn btn-info"value="Utfør bestilling" name="checkout_complete">

If anyone have any ideas to why this doesn’t work, and how i can get arround this, please let me know. Thanks.

2

Answers


  1. You have some disabled fields, but disabled fields are not sent on submit.
    You can try using readonly instead of disabled

    And make shure that the variables you use to prefill the value attributes are initialized:

    <!-- using the shorthand 'echo' -->
    <input type="email" value="<?= $db_email ?? '---' ?>
    

    Also, the piece of your code:

    if(isset($_POST['checkout_complete'])) {
        die("DEBUG: ".$_POST["tw_email"]);
      }
    }
    

    has one too many closing braces (but maybe it’s a typo)

    Login or Signup to reply.
  2. I believe what will work is a BUTTON element with both a name and value. Have you tried that?

    <button type="submit" class="btn btn-info" name="checkout_complete" value="someValue">Utfør bestilling</button>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search