Log in

View Full Version : Looking for a script as well...



OptimusGeorge
09-20-2007, 08:03 PM
I'm looking for a script that allows you to click radio buttons in different categories and then hit submit (or something like that). Then, based upon the buttons you have chosen, a certain page will load. Perhaps one of 3 different results pages. Any help would be appreciated.

Thanks!

Jas
09-21-2007, 06:44 PM
Which language are you interested in? I can give you an example in JavaScript or PHP, but I don't have time to do both :(

Let me know, and I'll be happy to give you some sample code.

djr33
09-21-2007, 06:50 PM
READ: http://www.dynamicdrive.com/forums/showthread.php?t=24866

OptimusGeorge
09-27-2007, 09:01 PM
Sorry about the bad post title. I didn't know...

I'm looking for a JavaScript that will do my request. I think I'll be able to understand it enough to place it into the html then. I just don't know how to write JavaScript myself.

Rockonmetal
09-27-2007, 09:51 PM
Ok OptimusGeorge I'll give you a php version of the script right now:

<form action="Decide.php">
<!-- Form Stuff -->
<input type="checkbox" name="PageOne" value="1" />
<input type="checkbox" name="PageTwo" value="2" />
<input type="submit" value="GO TO THERE!">
</form>
Thats the PHP code now keep two things in mind:

name="PageOne" value="1"
Here is the php code which goes on Decide.php

<?php
function GotoOne(){
echo "Page location: index.php, secret.htm, something.html, anything works just as long as its a real page...";
$br = "<br />";
}
function GotoTwo(){
echo "Second Page location: index.php, secret.htm, something.html, anything works just as long as its a real page...";
$br = "<br />";
}
$GotoPageone = $_POST["PageOne"];
//If you change PageOne in the form change it here!
$GotoPagetwo = $_POST["PageTwo"];
if($GotoPageone==1){
echo "Please click here:";
echo $br;
GotoOne();
}
if($GotoPagetwo==2){
GotoTwo();
}
?>


That should work... I don't know how to do it in javascript though cuz I am not good at it...

OptimusGeorge
09-28-2007, 12:54 PM
I don't think that will work. I just got the "real" low down on what needs to occur. There will be 16 or 17 different check boxes. If the user chooses 3 or less it goes to one page, 4-6 it goes to a second page, 7 or above goes to a third page.

Also, can a "submit" button be an image with a link instead of just a button? Or does it always have to be a button?

Rockonmetal
09-29-2007, 02:41 AM
Ok... I can do the image thing but its not really going to be an image...
enter this CSS code into the head of your page:

<style type="text/css">
.submit{
background: transparent url(image.ext)fixed no-repeat;
width: width in pixels;
height: height in pixels;
border: none;
}
</style>
Now use this code for your submit button:

<input type="submit" class="submit" value=" " />
That should help for the submit button...

Hold on man I can solve the thing if you tell me how many check boxes there are total and how many need to be selected to go to page one, how many for page two, and so on...

Hope that this helps!

OptimusGeorge
10-01-2007, 12:39 PM
Alright...

There are 16 or 17 boxes. If you choose 1-3 it goes to one page. If you choose 4-6 it goes to a second page. If you choose 7 or more it goes to a third page.

I think that's it.