I'm completely stumped at how I can change the opening tag to have 'method=post' if the second select option is chosen. I am using an Onchange for the form action, but can't figure out how to change the post method too. My latest attempt is with an IF statement as shown in the below code, but again, only 1 option will work.
if(this.value){
$content .='<form action="/gsresults">';
}
else{
$content .='<form action="/imagesearch?go" method="post">';
}
$content .='<input type="text" name="q"/>
<input type="hidden" name="cx" value="partner-pub-xxxxxxxxxxx" />
<input type="hidden" name="cof" value="FORID:11" />
<input type="hidden" name="ie" value="UTF-8" />
<select onchange="this.form.action=this.value">
<option value="/gsresults" selected="selected">Google</option>
<option value="/imagesearch?go">Images</option>
</select>
<input type="submit" name="sa"/>
</form>';
Thanks for any help/pointers.
Chris
Aucun commentaire:
Enregistrer un commentaire