| | |
drop down menu based on form input
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2008
Posts: 46
Reputation:
Solved Threads: 0
hi...
I am developing an application using PHP/MySQL.
here, i have one page(say P1), which contains a form(just one drop down menu, say D1, with only 2 options , say O1 and O2)...
the target of P1 is another page, say P2.
Now, P2 is also a form, and contains a number of fields (all text fields)...
THE PROBLEM
P2 also contains a drop down menu.
Now, this is not a static drop down menu.
If, on P1, the user selectes O1, then a particular drop down menu is displayed on P2.(say D2)
If, on P1, the user selects O2, then another drop down menu is shown (say D3)
Both D2 and D3 are different from D1.
I have coded this, but it shows me errors. I guess i may be mixing HTML and PHP code at some place, but am unable to figure it out... pls help me out if u can...
I am posting the code i developed...
THE CODE
P1.php
<html>
<form action = "P2.php" method = "POST">
<select name = "dbase">
<option>abc</option>
<option>xyz</option>
</select>
<input type="submit" value="Enter Client Details"/>
</form>
</html>
P2.php
<html>
<?php
$db = $_POST["dbase"];
?>
<form action = "P3.php" method = "POST">
Name: <input type = "text" name = "Name">
ID: <input type="text" name="ID" />
<?php
if($_POST["dbase"] == 'abc')
{
<select name = "tests">
<option>Maths</option>
<option>English</option>
</select>
}
else
{
Test : <select name = "tests">
<option>Physics</option>
<option>Chemistry</option>
<option>Geography</option>
</select>
}
?>
<input type="submit" value="Submit"/>
</form>
</html>
please help me out...
thx...
I am developing an application using PHP/MySQL.
here, i have one page(say P1), which contains a form(just one drop down menu, say D1, with only 2 options , say O1 and O2)...
the target of P1 is another page, say P2.
Now, P2 is also a form, and contains a number of fields (all text fields)...
THE PROBLEM
P2 also contains a drop down menu.
Now, this is not a static drop down menu.
If, on P1, the user selectes O1, then a particular drop down menu is displayed on P2.(say D2)
If, on P1, the user selects O2, then another drop down menu is shown (say D3)
Both D2 and D3 are different from D1.
I have coded this, but it shows me errors. I guess i may be mixing HTML and PHP code at some place, but am unable to figure it out... pls help me out if u can...
I am posting the code i developed...
THE CODE
P1.php
<html>
<form action = "P2.php" method = "POST">
<select name = "dbase">
<option>abc</option>
<option>xyz</option>
</select>
<input type="submit" value="Enter Client Details"/>
</form>
</html>
P2.php
<html>
<?php
$db = $_POST["dbase"];
?>
<form action = "P3.php" method = "POST">
Name: <input type = "text" name = "Name">
ID: <input type="text" name="ID" />
<?php
if($_POST["dbase"] == 'abc')
{
<select name = "tests">
<option>Maths</option>
<option>English</option>
</select>
}
else
{
Test : <select name = "tests">
<option>Physics</option>
<option>Chemistry</option>
<option>Geography</option>
</select>
}
?>
<input type="submit" value="Submit"/>
</form>
</html>
please help me out...
thx...
•
•
Join Date: Jun 2008
Posts: 46
Reputation:
Solved Threads: 0
one possible solution to this is:
If on P1, the user selects O1, i direct him to page Pa.php, which contains the drop down menu D2.
Instead, If on P1, the user selects O2, i direct him to page Pb.php, which contains the drop down menu D3.
though this is a possible solution, it also involves a problem.
Here, i will have to dynamically decide the target of my page P1, depending on whether the user chooses O1 or O2.
I have searched this. It is possible using javascript, but i havent found a solution to this using PHP.
So if anybody could please explani this, i would be really grateful...
thx a ton ...
If on P1, the user selects O1, i direct him to page Pa.php, which contains the drop down menu D2.
Instead, If on P1, the user selects O2, i direct him to page Pb.php, which contains the drop down menu D3.
though this is a possible solution, it also involves a problem.
Here, i will have to dynamically decide the target of my page P1, depending on whether the user chooses O1 or O2.
I have searched this. It is possible using javascript, but i havent found a solution to this using PHP.
So if anybody could please explani this, i would be really grateful...
thx a ton ...
Why so many "\n" between every line ? Anyway,
What are the errors ?
And what exactly are you trying to do ?
•
•
•
•
I have coded this, but it shows me errors. I guess i may be mixing HTML and PHP code at some place, but am unable to figure it out... pls help me out if u can...
And what exactly are you trying to do ?
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
Similar Threads
- update' select menu (PHP)
- Move Javascript Variable to PHP (JavaScript / DHTML / AJAX)
- AJAX : Am i right with the concept? (JavaScript / DHTML / AJAX)
- urgent-how to pass multiple values to the parent form (ASP)
- urgent-how to pass multiple values to the parent form (HTML and CSS)
Other Threads in the PHP Forum
- Previous Thread: help me......please
- Next Thread: Whois DATABASE?
| Thread Tools | Search this Thread |
apache api array autocomplete beginner binary body broken cakephp class cms code cron curl database dataentry date date/time display duplicates dynamic ebooks email emptydisplayvalue error execute explodefunction file firstoptioninphpdroplist folder form forms function functions google href htaccess html image include ip javasciptvalidation javascript joomla keywords limit link list login matching mediawiki menu msqli_multi_query multiple mycodeisbad mysql navigation number oop parameter paypal pdf php phpincludeissue query random recourse recursive regex script search seo server sessions shot source sp space speed sql static subdomain subscription system table tag tutorial tutorials update upload url validator variable vbulletin video web webdesign white xml youtube






