Results 1 to 10 of 40

Thread: Day 7 - Talk To Server - Become PHP Expert in 30 days

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2005
    Location
    India
    Posts
    11,004

    Default PHP GET with Bootstrap Form

    An attempt with bootstrap forms and php GET method

    http://php.flashwebhost.com/melbin/d...dent_data.html

    HTML Code:
    <!DOCTYPE html>
    <html>
      <head>
        <title>STUDENT DATA</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="css/bootstrap.css" />
        <script type="text/javascript" href="js/bootstrap.js"></script>
      </head>
    
      <body>
      <div class="container">
        <div class="row">
          <div class="span6 offset3">
            <h2 style="text-align:center;">Student Data</h2>
          </div>
      </div>
      <hr>
        <div class="row">
          <div class="span6 offset3">
            
            <form class="form-horizontal" method="GET" action="print_progress_report.php">
              <div class="control-group">
                <label class="control-label" for="studentname">STUDENT NAME</label>
                  <div class="controls">
                    <input type="text" id="studentname" name="studentname" placeholder="Enter Student Name">
                  </div>
              </div>
    
              <div class="control-group">
                <label class="control-label" for="std" name="std">STD</label>
                  <div class="controls">
                    <select name="std">
                    <option>SELECT STD</option>
                    <option>STD V</option>
                    <option>STD VI</option>
                    <option>STD VII</option>        
                    <option>STD VIII</option>        
                    <option>STD IX</option>        
                    <option>STD X</option>        
                    </select>
                  </div>
              </div>
    
              <div class="control-group">
                <label class="control-label" for="std">BATCH</label>
                  <div class="controls">
                    <select name="division">
                    <option>SELECT BATCH</option>
                    <option>A</option>
                    <option>B</option>
                    <option>C</option>        
                    <option>D</option>        
                    </select>
                  </div>
              </div>
    
              <div class="control-group">
                  <label class="control-label" for="language1">FIRST LANGUAGE</label>
                  <div class="controls">
                    <input type="text" name="language1" placeholder="Enter Mark between 0 and 100">
                  </div>
              </div>
    
              <div class="control-group">
                  <label class="control-label" for="language2">SECOND LANGUAGE</label>
                  <div class="controls">
                    <input type="text" name="language2" placeholder="Enter Mark between 0 and 100">
                  </div>
              </div>
    
              <div class="control-group">
                  <label class="control-label" for="physics">PHYSICS</label>
                  <div class="controls">
                    <input type="text" name="physics" placeholder="Enter Mark between 0 and 100">
                  </div>
              </div>
    
              <div class="control-group">
                  <label class="control-label" for="chemistry">CHEMISTRY</label>
                  <div class="controls">
                    <input type="text" name="chemistry" placeholder="Enter Mark between 0 and 100">
                  </div>
              </div>
    
              <div class="control-group">              
                  <label class="control-label" for="biology">BIOLOGY</label>
                  <div class="controls">
                    <input type="text" name="biology" placeholder="Enter Mark between 0 and 100">
                  </div>
              </div>
    
              <div class="control-group">              
                  <label class="control-label" for="maths">MATHEMATICS</label>
                  <div class="controls">
                    <input type="text" name="maths" placeholder="Enter Mark between 0 and 100">
                  </div>
              </div>
              
              <div class="form-actions">
                <button type="submit" class="btn btn-primary">Print Progress Report</button>
                <button type="reset" class="btn">Reset All</button>
              </div>
            </form>
          </div><!-- span6 -->
    </div><!-- .row -->
    </body>
    </html>  
    http://php.flashwebhost.com/melbin/d...ess_report.php

    PHP Code:
    <?php

        
    if (isset($_GET['studentname'])) {
            
    $studentname=$_GET['studentname'];
        } else {
        echo 
    'NO NAME';
        } 

        if (isset(
    $_GET['std'])) {
            
    $std=$_GET['std'];
        } else {
        echo 
    'No Data Found';
        } 

        if (isset(
    $_GET['division'])) {
            
    $division=$_GET['division'];
        } else {
        echo 
    'No Data Found';
        } 

        if (isset(
    $_GET['language1'])) {
            
    $language1=$_GET['language1'];
        } else {
        echo 
    'No Data Found';
        } 

        if (isset(
    $_GET['language2'])) {
            
    $language2=$_GET['language2'];
        } else {
        echo 
    'No Data Found';
        } 

        if (isset(
    $_GET['physics'])) {
            
    $physics=$_GET['physics'];
        } else {
        echo 
    'No Data Found';
        } 

        if (isset(
    $_GET['chemistry'])) {
            
    $chemistry=$_GET['chemistry'];
        } else {
        echo 
    'No Data Found';
        } 

        if (isset(
    $_GET['biology'])) {
            
    $biology=$_GET['biology'];
        } else {
        echo 
    'No Data Found';
        } 

        if (isset(
    $_GET['maths'])) {
            
    $maths=$_GET['maths'];
        } else {
        echo 
    'No Data Found';
        }

    $gtotal=$language1+$language2+$physics+$chemistry+$biology+$maths;

    echo 
    '<hr>';
    echo 
    '<b>' strtoupper($studentname) . ' ' $std ' ' $division '</b> <br>';
    echo 
    'FIRST LANGUAGE : ' $language1 '<br>';
    echo 
    'SECOND LANGUAGE : ' $language2 '<br>';
    echo 
    'PHYSICS : ' $physics '<br>';
    echo 
    'CHEMISTRY : ' $chemistry '<br>';
    echo 
    'BIOLOGY : ' $biology '<br>';
    echo 
    'MATHS : ' $maths '<br>';
    echo 
    '<hr>';
    echo 
    '<b> GRAND TOTAL : ' $gtotal '<b><br>';
    echo 
    '<hr>';
    echo 
    '<hr>';
    Last edited by melbin; 05-17-2014 at 07:55 AM. Reason: spelling mistake
    VIDEO WORLD : LATEST HOLLYWOOD || BOLLYWOOD || SOUTH INDIAN VIDEOS || TRAILERS

  2. #2
    Join Date
    Sep 2003
    Posts
    3,040

    Default

    @melbin, good script. Try to make simple scripts, so others can learn few things from it. I am sure sibi can make a better bootstrap page, but that only confuse others, some will even stop learning :)
    Become PHP Expert in 30 days
    FreeMarriage.com - Free Online Matrimonial
    FlashWebHost.com - Professional Web Hosting, Designing.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •