By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,278 Members | 1,342 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,278 IT Pros & Developers. It's quick & easy.

how to generate a title automatically

P: 32
i have created a drop down list that has the code no. of a subject. now i want that after a user select a code no the title corresponding to that code no. will automatically displayed in the title field.
How can i do this ?
Feb 26 '07 #1
Share this Question
Share on Google+
4 Replies


P: 99
i have created a drop down list that has the code no. of a subject. now i want that after a user select a code no the title corresponding to that code no. will automatically displayed in the title field.
How can i do this ?
i think you nean something like this

[PHP]
<form action="<?php echo $PHP_SELF; ?>" >
<select name="test">
<option value="1">test 1</option>
<option value="2">test 2</option>
<option value="3">test 3</option>
<option value="4">test 4</option>
</select><br>
<input type="submit" name="send" value="send">
</form>
<?php
if($_POST['send']){
echo $_POST['test'];
}
?>
[/PHP]

This will display the values of the dropdown.
Feb 26 '07 #2

P: 32
i think you nean something like this

[PHP]
<form action="<?php echo $PHP_SELF; ?>" >
<select name="test">
<option value="1">test 1</option>
<option value="2">test 2</option>
<option value="3">test 3</option>
<option value="4">test 4</option>
</select><br>
<input type="submit" name="send" value="send">
</form>
<?php
if($_POST['send']){
echo $_POST['test'];
}
?>
[/PHP]

This will display the values of the dropdown.
I dont mean that. I had created a table in database which has code no. and title of that code no. Now I had called the code no. in a drop down list. I want that when a user select a code no the title correspoding to that code displays in the title field. how can i do this?
Feb 27 '07 #3

P: 99
I dont mean that. I had created a table in database which has code no. and title of that code no. Now I had called the code no. in a drop down list. I want that when a user select a code no the title correspoding to that code displays in the title field. how can i do this?
In the titlefield of the page?
Feb 27 '07 #4

100+
P: 136
Hi,

I think you need to use javascript for this. I am putting a simple example for this bellow.

Expand|Select|Wrap|Line Numbers
  1. <html><head><title>title test</title>
  2. <script language="javascript">
  3. function fan()
  4. {
  5. var k = document.forms[0].aa[document.forms[0].aa.selectedIndex].value;
  6. document.title = k;
  7. }
  8. </script>
  9. </head>
  10. <body>
  11. <form>
  12. <select name="aa" onChange="fan()">
  13. <option value="1111">1111</option>
  14. <option value="2222">2222</option>
  15. <option value="3333">3333</option>
  16. </select></form>
  17. </body>
  18. </html>
Feb 27 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.