Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-27-2003, 09:41 AM
DeMuro1's Avatar
DeMuro1 DeMuro1 is offline
 
Join Date: Apr 2003
Location: A Golden State
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default html forms, php, and and (refreshing?) pages

here's my basic deal. I have a pulldown menu at the top of a page. I want to select an item on the pulldown and then have that open more fields below based on the selected item in the pulldown menu.

the only way I know how to do this is with an "if" block. I'm not sure though if that will automatically go to the if block.

if my html looks like this


<form action="pd_opt.php" method="get" name="myform">
What type of site addition is this?
<select name="pulldown">
<option value="1">option 1</option>
<option value="2">option 2</option>
</select><br>
</form>

and my php looks like this
PHP Code:
if ($pd_opt=1)
    {                    };
elseif (
$pd_opt=2)
    {                    }; 
Now will this update the lower part of the mage immediately or do I need to add something that I'm not aware of. Also what do I put in my {braces} that allows me to open another page, another php file or in my case add php to the bottom portion of a page

Thanks. I'm really new to php and I'm sorry as this most likely is a very trivial question
Reply With Quote
  #2  
Old 04-27-2003, 01:35 PM
Black Vivi's Avatar
Black Vivi Black Vivi is offline
 
Join Date: Dec 2002
Location: United Kingdom
Posts: 120
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You'd have to refresh the page, so make a form, name the "<select>" tag, (name it "pb_opt") (don't forget to put a submit button).
Below this add a line break, then put "<? echo($subopt); ?>" by itself.

In the braces, you'll need to put this:
PHP Code:
$subopt "THE HTML"
That's the way I'd make it anyway...
Reply With Quote
  #3  
Old 04-28-2003, 07:02 AM
DeMuro1's Avatar
DeMuro1 DeMuro1 is offline
 
Join Date: Apr 2003
Location: A Golden State
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Black Vivi you are the man. Again you help me out. Thanks a million.

I have one more question.

If the html form is in one document and the php is in another one how do I call the variable with echo from another document

or in other words

PHP Code:
$subopt "THE HTML"
is in a document called pd_opt.php

and I'm trying to get

PHP Code:
$subopt 
in the first document in the html, so do I need to include anything extra so I can get the variable into my html document???



ok I think I got it but can you let me know if this is right???
PHP Code:
<? 
function pulldown_type()
{
include(pd_opt.php);
echo($subopt); 
}


pulldown_type()
?>
is that right???
Reply With Quote
  #4  
Old 05-02-2003, 09:22 PM
Black Vivi's Avatar
Black Vivi Black Vivi is offline
 
Join Date: Dec 2002
Location: United Kingdom
Posts: 120
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

basically yea
but it would be easier to do this:
PHP Code:
include("pd_opt.php"); 
at the top of the page (under the <?)

then where you want the options displayed, put
PHP Code:
echo($subopt); 
otherwise it will be displayed where you put it in the page.

make sure there aren't any echos, prints or just output html in the pd_opt file tho


sorry about the late reply
Reply With Quote
  #5  
Old 05-02-2003, 09:33 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
04-27-03 at 06:41 AM DeMuro1 said this in Post #1
here's my basic deal. I have a pulldown menu at the top of a page. I want to select an item on the pulldown and then have that open more fields below based on the selected item in the pulldown menu.

the only way I know how to do this is with an "if" block. I'm not sure though if that will automatically go to the if block.

if my html looks like this


<form action="pd_opt.php" method="get" name="myform">
What type of site addition is this?
<select name="pulldown">
<option value="1">option 1</option>
<option value="2">option 2</option>
</select><br>
</form>

and my php looks like this
PHP Code:
if ($pd_opt=1)
    {                    };
elseif (
$pd_opt=2)
    {                    }; 
Now will this update the lower part of the mage immediately or do I need to add something that I'm not aware of. Also what do I put in my {braces} that allows me to open another page, another php file or in my case add php to the bottom portion of a page

Thanks. I'm really new to php and I'm sorry as this most likely is a very trivial question
Side note: use == if you want those conditions to work. Also proper indenting is your friend.
Reply With Quote
  #6  
Old 05-02-2003, 09:49 PM
DeMuro1's Avatar
DeMuro1 DeMuro1 is offline
 
Join Date: Apr 2003
Location: A Golden State
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah I forgot about the == instead of just the = thanks though. Black vivi again thanks for the feedback. I pretty much had it figured out though. I'm trying to teach myself how to save and make updating a webpage easy. I don't know anything about mySql and that's the easiest way to do it. I'm begining to see how mwsql would make this easier, fewer things in an array to keep track of but we'll see. next on my list of things to figure out. MySql
Reply With Quote
  #7  
Old 05-03-2003, 06:31 AM
Black Vivi's Avatar
Black Vivi Black Vivi is offline
 
Join Date: Dec 2002
Location: United Kingdom
Posts: 120
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

lol
goodluck then
Reply With Quote
  #8  
Old 05-06-2003, 08:19 AM
DeMuro1's Avatar
DeMuro1 DeMuro1 is offline
 
Join Date: Apr 2003
Location: A Golden State
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How important is extensive MySql Knowledge in making a database for my Web-site? is there something that will just give me the basics of what I need. PHP seems easy enough but MySql seems to be an animal of a different nature?
Reply With Quote
  #9  
Old 05-06-2003, 10:18 AM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you're making a database then MySQL is extremely important.
Reply With Quote
  #10  
Old 05-06-2003, 03:01 PM
Black Vivi's Avatar
Black Vivi Black Vivi is offline
 
Join Date: Dec 2002
Location: United Kingdom
Posts: 120
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

MySQL is actually quite easy from when u learn to create tables onwards (for me anyway)
Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:31 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06552 seconds
  • Memory Usage 2,275KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (8)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete