Thanks for the help everyone.  I have decided to use javascript to
deal with my second problem.  I understand that this is not a
JavaScript fourm but I am having some trouble getting my JS function
to work correctly.

Here is my JS code.

function getEquipment ()
{
        var mylist = document.getElementById("equip");
        if (mylist.options[mylist.selectedIndex].value=="other")
        {
                document.writeln("<tr>");
                document.writeln("      <td align="left">Other</td>");
                document.writeln("      <td><input type="text" name="other" 
size="20"></td>");
                document.writeln("</tr>");
        }
}

This is my code for where the function is called

<select name="equipment" size="1" id="equip" onChange="getEquipment()">
                            <option value="treadmill">Treadmil</option>
                            <option value="exercise bike">Exercise Bike</option>
                            <option value="other">Other</option>
                            <option value="rowing machine"
selected>Rowing Machine</option>
                          </select>

My problem is when the page loads in a web browser the Option "Other"
is selected every time. From what you can see from my code   "Rowing
machine is the one that I want to be shown when the page loads.

Anyway can anyonne tell me why my code is not executing correctly.  I
am not too familiar with java script.  What I am trying to accomplish
is if Other is selected then add a new table row below the drop down
menu with the content that I have in the function.

If no one can help with this would someone please direct me to a Java
Script  Forum.

Thanks

Paul

On 1/27/06, Weber Sites LTD <[EMAIL PROTECTED]> wrote:
> Check out this list of code examples to help with #1
> http://www.weberdev.com/AdvancedSearch.php?searchtype=title&search=validatio
> n
>
> Sincerely
>
> berber
>
> Visit the Weber Sites Today,
> To see where PHP might take you tomorrow.
> PHP code examples : http://www.weberdev.com
> Free Uptime Monitor : http://uptime.weberdev.com
> PHP content for your site : http://content.weber-sites.com
>
>
> -----Original Message-----
> From: Paul Goepfert [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 27, 2006 9:28 PM
> To: php-general@lists.php.net
> Subject: [PHP] questions regarding PHP and Forms
>
> Hi all,
>
> I am  writing my first website in php.  I have a few questions.
>
> 1) I need to do vaildation on form values that I have entered into a form.
> Is there a way I can write the vaildation code on the same page as the form
> in php?
>
> 2)  I have a drop down menu on one of my form fields.  What I want to do is
> if a certain item is seelected I want to have a new textbox appear below the
> drop down menu.  Is there a way to do this in php?
>
> Thanks
>
> Paul
>
> --
> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php
>
>
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to