View Full Version : Search Button Help
SHCustomer
31-03-2008, 01:00 PM
Hello habbox forum,
Need some help
I have a search engine script but im having a problem with the search buttons.
http://aycu37.webshots.com/image/49996/2001255424656946403_rs.jpg
WEB = Searches web.php
UK = Trying to search uk.php (see below)
At the momment the form will go to web.php But I have another script UK.php which I want to be selected when the user selects "UK Sites".
Does anyone know how to do this as everytime I do this I keeps going to web.php regardless of what radio button is selected (web or UK sites).
Moved by Hitman (Forum Moderator) from Technical Problems: Please post in the correct forum next time, thanks. :)
I don't code however, I have used PHP in the past and perhaps it's an if function, sorry I can't help much.
SHCustomer
31-03-2008, 04:02 PM
No worries, thanks anyway.
Robbie
31-03-2008, 04:28 PM
Just do something like
<?php
$type = $_POST["type"];
if($type == "UK") {
// Go to UK.php
} else {
// Go to whatever
}
?>
Obviously that won't really work because I don't know what your variables are called etc, but something like that.
Baving
31-03-2008, 06:44 PM
<script type="text/javascript">
var tempv = '';
function change_submit(id) {
if(id=='web') {
document.getElementById('frmSearch').action = 'web.php';
}elseif(id=='uk') {
document.getElementById('frmSearch').action = 'uk.php';
}
return true;
}
</script>
<form method="POST" id="frmSearch" onSubmit="return change_submit(tempv);">
<input type="text" name="search_text"><Br/>
<input type="submit" onclick="document.tempv='web';" value="Web"> <input type="submit" onclick="document.tempv='uk';" value="UK">
</form>
May need some adjusting
I would go with Bavings code, although if Javascript off you make it always go to web.php and just do Robbies code
Dentafrice
31-03-2008, 10:54 PM
<script type="text/javascript">
var tempv = '';
function change_submit(id) {
if(id=='web') {
document.getElementById('frmSearch').action = 'web.php';
}elseif(id=='uk') {
document.getElementById('frmSearch').action = 'uk.php';
}
return true;
}
</script>
<form method="POST" id="frmSearch" onSubmit="return change_submit(tempv);">
<input type="text" name="search_text"><Br/>
<input type="submit" onclick="document.tempv='web';" value="Web"> <input type="submit" onclick="document.tempv='uk';" value="UK">
</form>
May need some adjusting
I believe he wants to use the radio buttons though? Which I believe radio buttons handle onchange?
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.