I have a form <form action="search1.php" method="post" name="q"> <table align="center"><tr><td>Search for <strong>RINGTONES</strong>:</td><td> <input name="artist" type="text" value="Search i.e Rihanna" size="10" maxlength="100" onclick="if(this.value=='Search i.e Rihanna') this.value='';" class="input" style="width:185px; background-color:#fae9f2; border: solid #ffcce7 1px; font-size: 12pt;"></td><td> <input type="submit" name="search" id="search2" value='Search!'> </td></tr></table> </form> Now , i want to change form action page while submitting as <form action="search1.php?keywords=<some value>" method="post" name="q"> where <some value> is input value of field artist from the form can anyone help me to sort it out ? Thanks in advance
You don't need Javascript for that. You can do that with pure HTML: <form action="search1.php" method="get" name="q"> <!-- .... --> <input name="keywords" type="text" .... /> HTML: (Note the method = GET, and the field name = keywords.
No , My question was not the method of getting values on next page, I want to change url structure of next page based on user input, That means a user inputs test keyword in this form <form action="search.php" method="get" name="q"> <!-- .... --> <input name="keywords" type="text" .... /> My next page url should be search.php?keywords=test not search.php
rofl. You only need to do what you do if you want to send post & dynamic get variables, otherwise just use nico's code and it will work,
Lolz, Am i too complicated in my question. I do not want to post values , I want to change action url structure on submit button