Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 40

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

  1. #21
    Join Date
    Sep 2003
    Posts
    3,040

    Default

    Quote Originally Posted by image View Post
    DAY 7 PHP PROGRAMMING

    http://php.flashwebhost.com/tom/day_7_ex_2.html

    Code:
    <html>
    <body>
    
    
    <h1>Welcome to Online Booking Center</h1>
    
    
    <p>Please enter your email id below to book your show.</p>
    
    
    <form method="GET" action="http://www.catchmyseat.com">
        Enter Your Email ID: <input name="email" type="text">
        <button type="submit">Book Now</button>
    </form>
    
    
    </body>
    </html>
    http://php.flashwebhost.com/tom/day_7_ex_2.php

    Code:
    <?php
    
    
    echo '<h1>Hello, ' . $_GET['email'] . ' Wecome to Online Booking Center</h1>';

    I think many don't understand the concept. Why we have two files. In above example

    http://php.flashwebhost.com/tom/day_7_ex_2.php

    Is the PHP file. We need visitors enter their name, so that PHP script know name of visitor and show a personalized page with visitor name.

    The solution here with toms script is to use following URL

    Code:
    http://php.flashwebhost.com/tom/[email protected]
    Now you see

    Hello, [email protected] Wecome to Online Booking Center
    Now can we get our visitors to enter email ? Will visitors know how to get GET method or what is GET method ?

    This is where we need an HTML form page, where we ask user what is his email. Like

    http://php.flashwebhost.com/tom/day_7_ex_2.html

    In toms code

    Code:
    <form method="GET" action="http://www.catchmyseat.com">
    Action need to be set to our PHP file, that is

    Code:
    <form method="GET" action="day_7_ex_2.php">
    Hope everyone will try to understand this concept, ask others or discuss here if you don't understand, someone will be able to explain it better than me, or i can try again
    Become PHP Expert in 30 days
    FreeMarriage.com - Free Online Matrimonial
    FlashWebHost.com - Professional Web Hosting, Designing.

  2. #22
    Join Date
    Sep 2003
    Location
    india
    Posts
    11,527

    Default

    http://php.flashwebhost.com/annie/login.php

    Code:
     <?php
    
    if (isset($_GET['login'])) {
        echo '<h1> Login Successful!!</h1>';
        echo '<br>';
        echo '<pre>';
        print_r($_GET);
        echo '</pre>';
    } 
    else {
        echo '
    <html>
        <body>
    
        <h1>Customer Login</h1>
        <p>All the Power. Even more convenience</p>
       <form method="GET" action="login.php">
        Enter Username : <input name="username" type="text"><br>
        Enter Password : <input name="password" type="text"><br>
         <button type="submit" name="login"> LOG IN!</button>
        </form>
        </body>
        </html>
        '; }

  3. #23
    Join Date
    Feb 2005
    Location
    India
    Posts
    11,004

    Default


    http://php.flashwebhost.com/melbin/php_get_ex_1.php


    PHP Code:
    <?php
      
    if( $_GET["name"] || $_GET["age"] )
      {
         echo 
    "Welcome "strtoupper($_GET['name']) . "<br />";
         echo 
    "You are <b>"$_GET['age']. "</b> years old.";
         exit();
      }
    ?>

    <html>
    <body>
      <br>
      <form action="<?php $_PHP_SELF ?>" method="GET">
      Name: <input type="text" name="name" /><br>
      Age: <input type="text" name="age" /><br>
      <input type="submit" />
      </form>
    </body>
    </html>
    VIDEO WORLD : LATEST HOLLYWOOD || BOLLYWOOD || SOUTH INDIAN VIDEOS || TRAILERS

  4. #24
    Join Date
    May 2014
    Posts
    21

    Default

    http://php.flashwebhost.com/austin/day7.php

    I need help with this code!!!
    mine not working properly
    Code:
    <?php
    if(isset($_GET['name'])){
    echo 'i got the name';
    echo 'Hi '.$_GET['name'].' Whats up buddy!';
    }
    
    else{
    
    echo'
    <html>
    <body>
    <p> welcome to my website! </P>';
    
    echo'Whats you name?';
    
    echo'<form method="GET" action="day7.php">
     Enter you name : <input n="name" type="text">
     <button type="submit">Go</botton>
     </form>
    </body>
    </html>';
    }

  5. #25
    Join Date
    May 2014
    Posts
    21

    Default

    This one working.... i copy pasted that input codes and the $_GET code.
    still help me find the error in the previous code

    php.flashwebhost.com/austin/day7exp.php

    <?php

    if ($_GET['full_name']>0) {
    echo 'i got the name';
    echo 'Hi '.$_GET['full_name'].' Whats up buddy!';
    }

    else{

    echo'
    <html>
    <body>
    <p> welcome to my website! </P>';

    echo'Whats you name?';

    echo'<form method="GET" action="day7exp.php">
    Enter Your Name: <input name="full_name" type="number">

    <button type="submit">Go</botton>
    </form>
    </body>
    </html>';
    }

  6. #26
    Join Date
    Feb 2005
    Location
    India
    Posts
    11,004

    Default

    Quote Originally Posted by Austinwhite View Post
    http://php.flashwebhost.com/austin/day7.php

    I need help with this code!!!
    mine not working properly
    There is s a spelling mistake in the following line.

    HTML Code:
    Enter you name : <input n="name" type="text"> // input tag is 'name', not 'n'
    Change it to

    HTML Code:
    Enter you name : <input name="name" type="text">
    See the corrected script below.

    PHP Code:
    <?php
        
    if (isset ($_GET['name']) ) {
            echo 
    'i got the name';
            echo 
    'Hi ' $_GET['name'] . ' Whats up buddy!';
    }

    else {

        echo
    '
        <html>
        <body>
        <p> welcome to my website! </P>'
    ;

        echo 
    'Whats you name?';

        echo 
    '<form method="GET" action="day7.php">
         Enter you name : <input name="name" type="text">
         <button type="submit">Go</botton>
         </form>
        </body>
        </html>'
    ;
    }
    Last edited by melbin; 05-19-2014 at 09:23 AM. Reason: spelling mistake
    VIDEO WORLD : LATEST HOLLYWOOD || BOLLYWOOD || SOUTH INDIAN VIDEOS || TRAILERS

  7. #27
    Join Date
    Nov 2009
    Posts
    76,596

    Default

    Why? .....is not working

    http://php.flashwebhost.com/sherly/blogloginsubmit.php

    Code:
    <?php
    
    if (isset($_GET['submit'])) {
        echo '<h1>Blog Login Success!!</h1>';
        echo '<br>';
        echo '<pre>';
        print_r($_GET);
        echo '</pre>';
    } 
    else {
        echo '
    <html>
        <body>
    
        <h1>Visit Our Blog</h1>
        <p>Marriage Counseling -  Advice and Tip</p>
       <form method="GET" action="blogloginsubmit.php">
        Enter First Name : <input name="first name" type="text"><br>
        Enter Last Name : <input name="last name" type="text"><br>
        Enter Your Email : <input name="email" type="text"><br>
        Enter Your Password : <input name="password" type="text"><br>
         <button type="submit" name="login"> submit!</button>
        </form>
        </body>
        </html>
        '; }

  8. #28
    Join Date
    May 2014
    Posts
    21

    Default

    Ohh... i thought name too is a variable.
    like the name was a temp variable for input and then it is stored to another variable.

    Got the mistake. thx
    Last edited by Austinwhite; 05-19-2014 at 10:16 AM.

  9. #29
    Join Date
    Sep 2003
    Posts
    3,040

    Default

    Quote Originally Posted by sherlyk View Post
    Why? .....is not working

    http://php.flashwebhost.com/sherly/blogloginsubmit.php

    Code:
    <?php
    
    if (isset($_GET['submit'])) {
        echo '<h1>Blog Login Success!!</h1>';
        echo '<br>';
        echo '<pre>';
        print_r($_GET);
        echo '</pre>';
    } 
    else {
        echo '
    <html>
        <body>
    
        <h1>Visit Our Blog</h1>
        <p>Marriage Counseling -  Advice and Tip</p>
       <form method="GET" action="blogloginsubmit.php">
        Enter First Name : <input name="first name" type="text"><br>
        Enter Last Name : <input name="last name" type="text"><br>
        Enter Your Email : <input name="email" type="text"><br>
        Enter Your Password : <input name="password" type="text"><br>
         <button type="submit" name="login"> submit!</button>
        </form>
        </body>
        </html>
        '; }
    We are checking is a something with name "submit" is passed to PHP script.

    None of our input element have name "submit", to fix.

    find

    Code:
    <button type="submit" name="login"> submit!</button>
    Replace with

    Code:
    <button type="submit" name="submit">Some Nice Button Text Here</button>
    Become PHP Expert in 30 days
    FreeMarriage.com - Free Online Matrimonial
    FlashWebHost.com - Professional Web Hosting, Designing.

  10. #30
    Join Date
    Nov 2009
    Posts
    76,596

    Default

    http://php.flashwebhost.com/sherly/blog_loginsubmit.php

    Code:
    <?php
    
    if (isset($_GET['submit'])) {
        echo '<h1>Blog Login Success!!</h1>';
        echo '<br>';
        echo '<pre>';
        print_r($_GET);
        echo '</pre>';
    } 
    else {
        echo '
    <html>
        <body>
    
        <h1>Visit Our Blog</h1>
        <p>Marriage Counseling -  Advice and Tip</p>
       <form method="GET" action="blogloginsubmit.php">
        Enter First Name : <input name="first name" type="text"><br>
        Enter Last Name : <input name="last name" type="text"><br>
        Enter Your Email : <input name="email" type="text"><br>
        Enter Your Password : <input name="password" type="text"><br>
         <button type="submit" name="submit"> submit!</button>
        </form>
        </body>
        </html>
        '; }

Page 3 of 4 FirstFirst 1234 LastLast

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
  •