+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: PHP script help!!!!!

  1. #1
    davide78 is offline x10Hosting Member davide78 is an unknown quantity at this point
    Join Date
    Sep 2009
    Posts
    6

    PHP script help!!!!!

    Hi guys,

    I need to do something that for a lot of you would be very easy, but for me, that I do not know anything of php language, it is very hard to accomplish.

    What I want to do is to make a form field ( which I displayed below) add its details to the notes box after being submitted.

    Basically, I want my customers to choose one of the rooms in this cascade menu:

    <tr><td>Room*</td><td>

    <select name="Room" class="bookingtext">
    <option value="">Room...</option>
    <option value="Praia de Buzios">Praia de Buzios</option>
    <option value="Pirangi">Pirangi</option>
    <option value="Praia do Amor">Praia do Amor</option>
    <option value="Praia de Ponta Negra">Praia de Ponta Negra</option>
    <option value="Baia dos Golfinhos">Baia dos Golfinos</option>
    <option value="Praia de Genipabu`">Praia de Genipabu`</option>
    <option value="Praia do Meio">Praia do Meio</option>
    </select>
    </td></tr>

    and than, I would like the choice to be shown in the text box.

    Can someone tell me, step by step, how to do it?

    If necessary, I can post the whole [PHP]program.


    Thank you very much for your support.

    Davide78

  2. #2
    Brandon's Avatar
    Brandon is offline Former Senior Account Rep Brandon is on a distinguished road
    Join Date
    Jun 2006
    Location
    Tewksbury, MA
    Posts
    9,589

    Re: PHP script help!!!!!

    So you want the value of the dropdown to also be in a corresponding textbox on the same page?
    Thanks,
    Brandon Long

  3. #3
    kidas is offline x10Hosting Member kidas is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    42

    Re: PHP script help!!!!!

    hope this will help :




    <?php
    if(!empty($_GET['Room'])) echo "selected room <input type=text value=\"".addslashes($_GET['Room'])."\">";
    else
    echo "select a room :D";
    ?>
    <form methode=get>
    <tr><td>Room*</td><td>

    <select name="Room" onchange=this.parentNode.submit(); class="bookingtext">
    <option value="">Room...</option>
    <option value="Praia de Buzios">Praia de Buzios</option>
    <option value="Pirangi">Pirangi</option>
    <option value="Praia do Amor">Praia do Amor</option>
    <option value="Praia de Ponta Negra">Praia de Ponta Negra</option>
    <option value="Baia dos Golfinhos">Baia dos Golfinos</option>
    <option value="Praia de Genipabu`">Praia de Genipabu`</option>
    <option value="Praia do Meio">Praia do Meio</option>
    </select>
    </td></tr>
    </form>

  4. #4
    davide78 is offline x10Hosting Member davide78 is an unknown quantity at this point
    Join Date
    Sep 2009
    Posts
    6

    Re: PHP script help!!!!!

    So you want the value of the dropdown to also be in a corresponding textbox on the same page? __________________
    Thanks,
    Brandon


    Hi Gays,

    Sorry, I was not very clear before....Yes, I want the value of the dropdown menu to show also in the textbox, which is in the same page.

    Do you know how to do it?

    Thank you

    Daviden1
    Last edited by davide78; 10-02-2009 at 11:22 PM.

  5. #5
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: PHP script help!!!!!

    Do you want to store the option selected as well, or is it okay if it disappears after use?

    BTW, you should all use the [ PHP] [ /PHP], [ HTML] [ /HTML], [ CODE] [ /CODE] (remove the spaces) tags when posting code on the forums.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  6. #6
    swhybd3 is offline x10Hosting Member swhybd3 is an unknown quantity at this point
    Join Date
    Aug 2009
    Posts
    1

    Re: PHP script help!!!!!

    thnks i will flow it.....can u help me how can i creat a html site

  7. #7
    davide78 is offline x10Hosting Member davide78 is an unknown quantity at this point
    Join Date
    Sep 2009
    Posts
    6

    Re: PHP script help!!!!!

    Do you want to store the option selected as well, or is it okay if it disappears after use?

    Hi Guys,

    Yes, I would like the option selected be stored in the textbox after the use...

    Is it possible?

    Thank you again.

    Davide78

  8. #8
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: PHP script help!!!!!

    Quote Originally Posted by davide78 View Post
    Quote Originally Posted by xav0989 View Post
    Do you want to store the option selected as well, or is it okay if it disappears after use?
    Yes, I would like the option selected be stored in the textbox after the use...
    This doesn't answer xav's question.


    JS would be a more efficient choice, as it would reduce a round-trip. You'd still want the PHP handler, for those browsers that have JS disabled or don't support JS.

    HTML Code:
    <form ...>
       <select name="Room" onchange="roomChange(this);">
          ...
       </select>
       <input name="RoomName" value="<?php isset($_REQUEST['RoomName']) && echo $_REQUEST['RoomName']; ?>"/>
    </form>
    <script type="text/javascript">
        function roomChange(roomField) {
            roomField.form.RoomName.value = roomField.value; 
        }
    </script>
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  9. #9
    kidas is offline x10Hosting Member kidas is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    42

    Re: PHP script help!!!!!

    Quote Originally Posted by kidas View Post
    hope this will help :



    Code:
    <?php
    if(!empty($_GET['Room'])) echo "selected room <input type=text value=\"".addslashes($_GET['Room'])."\">";
    else
    echo "select a room :D";
    ?>
    <form methode=get>
    <tr><td>Room*</td><td>
    
    <select name="Room" onchange=this.parentNode.submit(); class="bookingtext">
    <option value="">Room...</option>
    <option value="Praia de Buzios">Praia de Buzios</option>
    <option value="Pirangi">Pirangi</option>
    <option value="Praia do Amor">Praia do Amor</option>
    <option value="Praia de Ponta Negra">Praia de Ponta Negra</option>
    <option value="Baia dos Golfinhos">Baia dos Golfinos</option>
    <option value="Praia de Genipabu`">Praia de Genipabu`</option>
    <option value="Praia do Meio">Praia do Meio</option>
    </select>
    </td></tr>
    </form>
    hh anyone has see my code ?? it's not what u was looking for ??????? ppfffff

  10. #10
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: PHP script help!!!!!

    Quote Originally Posted by kidas View Post
    hh anyone has see my code ?? it's not what u was looking for ??????? ppfffff
    Don't be so self-centered. Maybe you should have used the [ PHP] tags to make your code stand out, and also, as misson pointed out, there are better ways of achieving the same thing.

    @davide78: do you want the value to be stored (kept on the server, so it always show up)
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Php script for mail doens't work anymore
    By messa in forum Free Hosting
    Replies: 1
    Last Post: 02-03-2009, 09:43 AM
  2. Photo-Graffix Gallery Php Script...
    By millart in forum Free Hosting
    Replies: 7
    Last Post: 09-17-2008, 11:42 AM
  3. foward mail to a php script
    By ruicos in forum Programming Help
    Replies: 3
    Last Post: 09-13-2008, 07:55 AM
  4. Cannot get php script to work
    By avidgamer in forum Free Hosting
    Replies: 3
    Last Post: 09-03-2008, 04:35 PM
  5. Replies: 3
    Last Post: 03-10-2008, 12:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers