Loading ...
Sorry, an error occurred while loading the content.
 

Re: [phpXperts] Varibale Problem

Expand Messages
  • Watson L
    It s done now. Thank you very much. extract ($_POST) is the statement to make on register_global ? Best Regards, Son Tushar Saha wrote:
    Message 1 of 3 , Nov 2, 2008
      It's done now. Thank you very much.
      extract ($_POST) is the statement to make on register_global ?

      Best Regards,

      Son

      Tushar Saha <tusharcsebd@...> wrote:
      U can try this code

      <?php
      if($_REQUEST[ 'save'] != '')
      {
      extract($_POST) ;
      if (empty($nam) or empty ($email))
      {
      print("Please fill name, email, and comment");
      echo($nam);
      print ("Email : $email");
      exit;
      }
      //save
      $pegangan=fopen( "guestbook.dat" ,"a") ;
      fputs ($pegangan,$ name . "\n");
      fputs($pegangan, $school . "\n");
      fputs($pegangan, $email . "\n");
      fputs($pegangan, $tel . "\n");
      fputs($pegangan, $comment . "\n");
      fputs($pegangan, "*-*\n");
      fclose($pegangan) ;

      print ("Hallo, $nama. The data is saved <BR>\n");
      print("Thank you. <br>\n");

      }
      ?>


      <html>
      <head>
      <title>Guest Book</title>
      </head>

      <body>
      <form action="save. php" method="post" enctype="multipart/ form-data" >
      <p>Name :
      <INPUT type="text" name="nam" size="50">
      <br>
      School :
      <input name="school" type="text" size="50">
      <br>
      Email :
      <input name="email" type="text" size="50">
      <br>
      Tel.
      <input name="tel" type="text" size="50">
      <br>
      Comment:
      <textarea Rows=7 cols=60 name="comment" ></textarea>
      </p>
      <p>
      <input name="save" type="submit" value="Save" >
      <input type="text" name="textfield" >
      </p>
      </form>
      </body>
      </html>

      save.php
      <html>
      <head>
      <title>Untitled Document</title>
      </head>

      <body>
      </body>
      </html>

      Thanks
      Tushar
      Technobd



      From: Watson L <phpmks@yahoo. com.sg>
      To: phpexperts@yahoogro ups.com
      Sent: Monday, November 3, 2008 8:17:08 AM
      Subject: [phpXperts] Varibale Problem

      Dear all,
      I tried to save form to a dat file but the varible that I use is always empty.

      Here is the Scripn:
      <html>
      <head>
      <title>Guest Book</title>
      </head>

      <body>
      <form action="save. php" method="get" >
      <p>Name :
      <INPUT type="text" name="nam" size="50">
      <br>
      School :
      <input name="school" type="text" size="50">
      <br>
      Email :
      <input name="email" type="text" size="50">
      <br>
      Tel.
      <input name="tel" type="text" size="50">
      <br>
      Comment:
      <textarea Rows=7 cols=60 name="comment" ></textarea>
      </p>
      <p>
      <input type="submit" value="Save" >
      <input type="text" name="textfield" >
      </p>
      </form>
      </body>
      </html>

      save.php
      <html>
      <head>
      <title>Untitled Document</title>
      </head>

      <body>
      <?php
      if (empty ($nam) or empty ($email))
      {
      print("Please fill name, email, and comment");
      echo($nam);
      print ("Email : $email");
      exit;
      }
      //save
      $pegangan=fopen( "guestbook.dat" ,"a") ;
      fputs ($pegangan,$ name . "\n");
      fputs($pegangan, $school . "\n");
      fputs($pegangan, $email . "\n");
      fputs($pegangan, $tel . "\n");
      fputs($pegangan, $comment . "\n");
      fputs($pegangan, "*-*\n");
      fclose($pegangan) ;

      print ("Hallo, $nama. The data is saved <BR>\n");
      print("Thank you. <br>\n");
      ?>
      </body>
      </html>

      The problem is  $nam, $email, $school and $comment is always empty. What's wrong ? Please assist me.
      Thank you.

      Regards,

      Son

      New Email addresses available on Yahoo!
      Get the Email name you've always wanted on the new @ymail and @rocketmail.
      Hurry before someone else does!



      New Email names for you!
      Get the Email name you've always wanted on the new @ymail and @rocketmail.
      Hurry before someone else does!


      New Email addresses available on Yahoo!
      Get the Email name you've always wanted on the new @ymail and @rocketmail.
      Hurry before someone else does!

    Your message has been successfully submitted and would be delivered to recipients shortly.