SunQuest
           Beginner Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherBeginner Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 7th, 2003, 02:04 PM
geezer442 geezer442 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Peterborough, UK
Posts: 3 geezer442 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Drop Down Box Help for Beginner

I hope someone can help me out there. I am trying to add a drop down box within a web page and I would like the options to be similar to the following example:

Where did you hear about the site?

Internet
Magazine
Other

When the user clicks Internet another drop down box would appear and give more options like

Google
Yahoo

I then would like Google to be stored so I can place them in some sort of database for reference. Is this possible? I will appreciate all the help I can get on this as I am very much a novice and I have already pulled out all of my hair. If this is not possible can it be done with radio buttons instead

Reply With Quote
  #2  
Old July 7th, 2003, 03:25 PM
Edox Edox is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 15 Edox User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I'm pretty sure it can be done with Javascript.

www.w3schools.com has a pretty decent tutorial to walk you through Javascript.

Reply With Quote
  #3  
Old July 8th, 2003, 11:33 AM
geezer442 geezer442 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Peterborough, UK
Posts: 3 geezer442 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for that, I have never been there before. I will have alook

Reply With Quote
  #4  
Old July 8th, 2003, 11:44 AM
geezer442 geezer442 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Peterborough, UK
Posts: 3 geezer442 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Is it possible to hide a drop down box when you enter a page?

Reply With Quote
  #5  
Old July 9th, 2003, 02:02 PM
dmonk dmonk is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 22 dmonk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
PHP writing to a file

I'm new to PHP but I have a class assignment right now that resembles what you need. (I'm just getting started on it), but I think what you need to do.

I think they call it "writing to a file" (text file).

with this function you can write to the file (saved on your server somewhere) then later you can open it and read it.

This may give you an idea of what the code would look like:
If this helps then, good. If not take your question over to the PHP forum. Sorry if it's a vague answer, this is only my second week with PHP and haven't finished reading the chapter on the book yet...but I know you answer is in there. Maybe someone else can elaborate?

P.S.
I'm assuming that you want to keep things simple i.e. get the info from one text file and then create a database with that info. If you want to use a "real" database like MySQL then definitively, go to the PHP forum with your question.

PHP Code:
//*************************************************
//Write out records with data if they exist.
//*************************************************

$action $HTTP_POST_VARS['action'];

if (
$action == 'update')  This looks at the value of the hidden field
{                                       The first time the program is called it doesn't exist

    @ $fp = fopen("test.txt", '
w');    //Open text file for Write


    {
        $item_name = '
source';
        $item_value = $HTTP_POST_VARS[$item_name];

        if (empty($item_value)) {
            break;     Exits the loop control
        }

        // Write out value to file
        $outline = "*$item_value*\n";
        fwrite($fp, $outline);


    }

    fclose($fp);

}

//*************************************************
//Now Read text file and Display
//*************************************************


@ $fp = fopen("test.txt", '
r');    //Open file for reading

if ($fp)
{
    while (true)
    {
        $line = fgets($fp,200);    
\\Reads a line in the file 

Last edited by dmonk : July 9th, 2003 at 02:05 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherBeginner Programming > Drop Down Box Help for Beginner


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway