dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: simple html code help

  1. #1
    Join Date
    Nov 2010
    Posts
    22

    simple html code help

    Hey everyone
    Please i would like to create a kind of quotation form with 2 ends (front and back). The front end would be a text box and a submit button and the back end would supply the response to the query / request that was inputed in the textbox at the front end. For example if the word that was typed in the text box is "apple" then the back end would return the word "fruit" on the page , but if the word that was typed in the text box is "cabbage" then the back end would return the word "this is not a fruit".

    Its a silly example but i hope it gives you a better picture of what i am trying to do . Its just a simple script and i really hope someone could help out with this.
    Thanks

  2. #2
    Join Date
    Mar 2005
    Location
    Behind you...
    Posts
    1,031
    There are a couple of ways you could do this. Technically you could build all of this in one page (no back-end coding required). But I guess this kind of depends on how many words you want to generate a response for. If it's a large list then you probably want a back-end and you'll probably want to use a database at that.

    The other thing would be how specific you want the matching to be. Now I don't know what this page is going to be for but using your example, if someone types "apple" they will get "fruit". But what if they type in "apples" or "some apples"? Again, since I don't know what this page is for I don't know how many different words or combinations people would be entering into this textbox. But it is still something to consider when writing a script. Plus as I read your post again I can't help but wonder if you want a list of words that get matched to their own specific phrases, or do you want a list of words and everything else that doesn't match gets your "this is not a fruit" message?

    For example, do you want something like:
    apple, banana, orange, grape, watermelon = fruit
    everything else = this is not a fruit

    Or are you looking for something more or less like
    apple = fruit
    banana = fruit
    orange = fruit
    grape = fruit
    watermelon = fruit
    cabbage = this is not a fruit


    Once I better understand what you are looking for I can help you get some code that will do the job.

  3. #3
    Join Date
    Mar 2014
    Posts
    7
    What language would you like for the backend? This could be done with a variety of backend languages and even Javascript so the answer will be different depending on your response.

    To get the front-end aspect started, the following HTML mark-up can be used:

    <form id="fruitChecker" method="get" action="backendFruitChecker.php">
    <label for="fruitName">Enter the food you would like to loo<br>
    <input type="text" name="fruitName" value="">
    <input type="submit" name="submit" value="Submit">
    </form>

    Note: this form submits to a back-end PHP file.

  4. #4
    Join Date
    Nov 2010
    Posts
    22
    Quote Originally Posted by talleagle View Post
    What language would you like for the backend? This could be done with a variety of backend languages and even Javascript so the answer will be different depending on your response.

    To get the front-end aspect started, the following HTML mark-up can be used:

    <form id="fruitChecker" method="get" action="backendFruitChecker.php">
    <label for="fruitName">Enter the food you would like to loo<br>
    <input type="text" name="fruitName" value="">
    <input type="submit" name="submit" value="Submit">
    </form>

    Note: this form submits to a back-end PHP file.
    Thanks for your reply , Hey can you PM me?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles