Как получить значения из формы в мой сегмент php? Мой сегмент php не распознает кнопку отправки - PullRequest
0 голосов
/ 28 марта 2019

У меня есть форма, которая принимает данные от пользователей и отправляет их в php, но проблема заключается в том, что при нажатии кнопки отправки сегмент php не распознает их.Какую ошибку я делаю?Буду признателен за любую помощь.

Я написал этот код, просто проверьте его ..

 <form  action="dash.php" method="post" id="msform">

        <ul id="progressbar">
          <li class="active">About</li>
          <li>Details</li>
          <li>Submission</li>
        </ul>

        <fieldset class="first">
          <!-- <h2 class="fs-title">SignIn</h2> -->
          <h3 class="fsf-subtitle">About Blood-Camp</h3><br>
          <input type="text" name="email" placeholder="Contact Email" required/>
          <input type="text" name="number" placeholder="Contact Number" required/>
          <input type="text" name="name" placeholder="Contact Person Name" required/>
          <input type="button" name="next" class="next firstbutton action-button" value="Next" />
        </fieldset>
        <fieldset class="second">
          <!-- <h2 class="fs-title">Topic</h2> -->
          <h3 class="fsf-subtitle">Details about Blood-Camp</h3><br>
          <input type="text" name="city" placeholder="City" required/>
          <input type="text" name="address" placeholder="Address" required/>
          <input type="text" name="date" placeholder="Date" required/>
          <input type="text" name="time" placeholder="Timing" required/>

          <input type="button" name="previous" class="previous action-button" value="Previous" />
          <input type="submit" name="submit" class="next secondbutton action-button" value="Submit" />
        </fieldset>

        <fieldset class="third">
          <!-- <h2 class="fs-title">Topic</h2> -->
          <h3 class="fsf-subtitle">Thank You:)</h3><br><hr><br>
          <h4> Organization Name:-</h4><br>
          <h4> Contact No:-</h4><br>
          <h4> Email:-</h4><br>
          <h4> Address:-</h4><br>
          <h4> City:-</h4><br><hr><br>
            <h4>Your Blood Camp Details Will Be Updated And Everyone Will Get Notified Within 24 Hours Of Time.</h4><br><hr><br>
          <h4> Your Organization Is Creating a Deep Impact On Society :) </h4>


        </fieldset>


      </form>

    </section>

    </div>

    <script>

    var parent, next_fs, previous_fs;



    $(".next").click(function(){
      parent = $(this).parent();
      next_fs = $(this).parent().next();
      prev_fs = $(this).parent().prev();
      $(parent).hide();
      $(next_fs).show();
      $("#progressbar li").eq($("fieldset").index(parent)).addClass("active");
       // $("#progressbar li").eq($("fieldset").index(parent)).removeClass("active");

     });

     $(".previous").click(function(){
       parent = $(this).parent();
       prev_fs = $(this).parent().prev();
       $(parent).hide();
       $(prev_fs).show();
       // $("#progressbar li").eq($("fieldset").index(prev_fs)).addClass("active");
       $("#progressbar li").eq($("fieldset").index(prev_fs)).removeClass("active");

     });
     </script>
    </body>


    </html>

    <?php

        include('../dbcon.php');

        if(isset($_POST['submit'])){


           echo('divesh'); 

?>

Я ожидаю, что по крайней мере, когда нажмите кнопку отправки, phpсегмент распознает это

1 Ответ

0 голосов
/ 28 марта 2019

Предполагая, что форма находится на странице dash.php, переместите свой php-код в тело вашего html.

<html>
  <head>
    <title>
       dash.php
    </title>
  </head>
  <body>
    <?php
    include('../dbcon.php');
    if(isset($_POST['submit'])){
       echo('divesh');
       // print_r($_POST);
    }  
     ?>
    <form action="dash.php" method="post" id="msform">
      <!-- form fields and submit button -->
    </form>
  </body>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...