Lost Password?

Go Back   CodeCall Programming Forum > Web Development Forum > PHP Forum

PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-06-2008, 11:26 AM
Hrimthurs Hrimthurs is offline
Newbie
 
Join Date: Jan 2008
Posts: 7
Rep Power: 0
Hrimthurs is on a distinguished road
Default Dynamically update php variables based on option value

Hi there,
This is a little hard to explain, but i'll give it a go.
What i need to do is have a <select> dropdown with options, eg.
HTML Code:
<select name="finish">
<option  value="" selected="selected">Select a finish</option>
<option value="white">White</option>
<option value="black">Black</option>
</select>
Of which, the selected option is called in as a variable via php and echoed later on in the same page, which dynamically updates when you select a different option.
I thought the code would look something like this
PHP Code:
<?php echo $_GET['finish']; 
echo 
$finish?>
But that method won't update dynamically.
Is anyone able to help?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 05-06-2008, 01:45 PM
phpforfun's Avatar   
phpforfun phpforfun is offline
Programming God
 
Join Date: Feb 2008
Posts: 588
Last Blog:
ubuntu... do not upgra...
Rep Power: 5
phpforfun will become famous soon enough
Default Re: Dynamically update php variables based on option value

do you mean this?

PHP Code:
<?
if(isset($_GET['finish'])){
     Echo 
$_GET['finish'];
} Else {
     
//code to echo form
}
?>

Last edited by John; 05-06-2008 at 02:53 PM. Reason: fixed syntax error
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-06-2008, 02:57 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 19
Posts: 2,402
Last Blog:
Object Oriented Design...
Rep Power: 50
John is a glorious beacon of lightJohn is a glorious beacon of lightJohn is a glorious beacon of lightJohn is a glorious beacon of lightJohn is a glorious beacon of light
Send a message via AIM to John
Default Re: Dynamically update php variables based on option value

I'm not 100% sure what you mean, but if you are using a form, the code from phpforfun will work. If you do not intend on using a form to submit the data, you would need to use JavaScript as well as PHP.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-06-2008, 05:00 PM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Age: 26
Posts: 4,707
Last Blog:
PHP: gzip Compression
Rep Power: 50
Jordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud of
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default Re: Dynamically update php variables based on option value

Do you mean when the user changes selection that the PHP value updates? For that you will need to use AJAX (JavaScript and PHP) or just JavaScript.
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
Don't hesitate to ask any questions that you have! Check out our ASCII Calculator!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP 5 and OOP Jordan PHP Tutorials 2 07-17-2008 09:43 AM
PHP 4 end of life announcement Jordan Programming News 4 08-30-2007 09:55 AM


All times are GMT -5. The time now is 02:15 AM.

Contest Stats

dargueta ........ 128.00000
John ........ 127.00000
Xav ........ 107.00000
gaylo565 ........ 18.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

Ads