Post data to site and get response

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • d00m
    New Member
    • May 2010
    • 2

    Post data to site and get response

    guys i want some script in which i have some text boxes for user to put in data and then that data goes to a certain site and get the response if the data is valid or not

    1.Post data to a site(specific fields)
    2.Response (If data is good show Valid data else invalid data)
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    To allow users to enter and send data to your site, you use the <form> element. You can find details on how to use it in this article.

    But, basically, you can set up two pages in your site. For example "index.html " and "validate.p hp". In the HTML page you create a form, and in the PHP page you accept the data and validate it.

    index.html
    [code=html]<form action="validat e.php" method="post">
    <input type="text" name="theData"> <br>
    <input type="submit">
    </form>[/code]

    validate.php
    [code=php]<?php
    if(isset($_POST['theData'])) {
    $theData = $_POST['theData'];

    // And now the text you entered
    // into the form is in the $theData
    // variable, so you can use it in any
    // way you want.
    }
    else {
    // An error message if the data was
    // not sent with the request. (Meaning
    // that the "validate.p hp" was requested
    // directly, without using the form.)
    echo "The data was not sent!";
    }
    ?>[/code]

    Comment

    • d00m
      New Member
      • May 2010
      • 2

      #3
      well thanx bro i got that form part that u said only simple noob question can i make my html in FRONTPAGE???
      but i did not get the validate.php part :(
      well i did not get where i`ll put the url of other site in validate.php on which data is to be validated and then return answer to index.html

      Comment

      Working...