n00b Looking for Advice On a Project

Status
Not open for further replies.

Drover

New member
Nov 28, 2006
369
1
0
Houston, TX
I'm working on a project and have no idea how to go about it. I considered using rentacoder or elance or something, but decided I should really know how to do more of this myself, and since I'm not really in a hurry, I'd like to use this as a learning opportunity.

What I have is a basic html site I created with a form containing a series of checkboxes, radio buttons and dropdowns. What I'd like to happen is once they hit submit, they'll be directed to a simple page based on cheir choices on the form. The pages can either be static pages I'll create or something dynamically generated, which I have no idea how to do either. I assume the former is the simpler route?

So what's the simplest way to do something like this? Do I need to create a database of some kind or is there a simpler way?

Also, my coding knowledge consists almost entirely of some basic html stuff, but like I said, I'd like to learn more.

Thanks in advance,

Drover
 


Ha!

I checked out the link and when I saw the cover with 2 birds and the author "O'REILLY", I had to double check my browser to make sure Emp wasn't pulling something. :D
 
ha

orly.gif
!= O'reilly
 
What I have is a basic html site I created with a form containing a series of checkboxes, radio buttons and dropdowns. What I'd like to happen is once they hit submit, they'll be directed to a simple page based on cheir choices on the form. The pages can either be static pages I'll create or something dynamically generated, which I have no idea how to do either. I assume the former is the simpler route?
So what's the simplest way to do something like this? Do I need to create a database of some kind or is there a simpler way?


It would make a lot of scenes to pick up a PHP book in your local book store for this.

But here's a couple of answers for you.

I think you want the following.

Page A has a form with a couple of Checkboxes, or radio buttons.

If they choose on the first radio button you want them to go to page B
If they choose on the second one you want them to go to page C
(repeat until you're done with your pages)

If your server accepts PHP do this on your "page a"

Code:
<form action="redirect.php" method="POST">
<input type=radio name=WhichPage value="PageA" selected>Page A<BR>
<input type=radio name=WhichPage value="PageB" selected>Page B<BR>
<input type=radio name=WhichPage value="PageC" selected>Page C<BR>
<input type=submit value="Submit">
</form>
Then make yourself a text file called "redirect.php" and in that file put:
Code:
<?PHP

switch($_POST['WhichPage'])
{
case "PageA": header("location: PageA.html"); break;
case "PageB": header("location: PageB.html"); break;
case "PageC": header("location: PageC.html"); break;
default: echo "Doh!...I don't know that page";
}

?>
That should do it. you see where it says "PageA.html" you would obviously have the right page there.

Enjoy.
 
Last edited:
td,

Thanks. If only it were that simple. What I have is a couple of questions with several radio button choices and then a list of options with like 15 checkboxes (of which they can choose several). Then a page needs to load based on what they choose for all of those. Is there a simple way (like the one you described) to do that using php?
 
Thats not really specific enough to give you the proper advice. Do you have a sample of your form and what you need to load based on what conditions? Please try to be more specific and I can get you started on the right track.

@ thedamian - Radio buttons use "checked" not "selected" and you cannot have 3 radio buttons with the same name and all of them checked. In a radio button group, only one can be checked at a time.
 
Teach a man to fish..

These are pretty basic questions. Learn a little bit about the technology and you will be surprised at the things you can accomplish.
 
Teach a man to fish..

These are pretty basic questions. Learn a little bit about the technology and you will be surprised at the things you can accomplish.

Yeah, I hope I made clear that a little fishing lesson is really what I'm looking for and not someone to do it for me. Just looking to be pointed in the right direction.
 
Thats not really specific enough to give you the proper advice. Do you have a sample of your form and what you need to load based on what conditions? Please try to be more specific and I can get you started on the right track.

@ thedamian - Radio buttons use "checked" not "selected" and you cannot have 3 radio buttons with the same name and all of them checked. In a radio button group, only one can be checked at a time.

Well the pages that I want to load based on the responses to the form have not been created. Like I said, I can either create like a couple dozen different ones or let them be dynamically created depending on how difficult that is to accomplish.

I'd really rather not post the form but it looks something like this:

<form action="http://xxxxxx.com/xxxxxxx.php" method="post">
<p>
<input type="radio" name="type" value="xxxx" /> XXXXXX
<br>
<input type="radio" name="type" value="yyyy" /> YYYYYY
<br >
<br >
Please choose your options:
<br><br>
<input type="checkbox" name="options" value=" XYZ1" /> XYZ1
<br>
<input type="checkbox" name="options" value=" XYZ2" /> XYZ2
<br>
<input type="checkbox" name="options" value=" XYZ3" /> XYZ3
<br>
<input type="checkbox" name="options" value="XYZ4" /> XYZ4
<br>
<input type="checkbox" name="options" value="XYZ5" /> XYZ5
<br>
<input type="checkbox" name="options" value="XYZ6" /> XYZ6
<br>
<input type="checkbox" name="options" value="XYZ7" /> XYZ7
<br>
<input type="checkbox" name="options" value="XYZ8" /> XYZ8
<br>
<input type="checkbox" name="options" value="XYZ9" /> XYZ9
<br>
<input type="checkbox" name="options" value="XYZ10" /> XYZ10
<br>
<input type="checkbox" name="options" value="XYZ11" /> XYZ11
<br>
<input type="checkbox" name="options" value="XYZ12" /> XYZ12
<br>
<input type="checkbox" name="options" value="XYZ13" /> XYZ13
<br>
<input type="checkbox" name="options" value="XYZ14" /> XYZ14
<br>
<input type="checkbox" name="options" value="XYZ15" /> XYZ15
<br>
<input type="checkbox" name="options" value="XYZ16" /> XYZ16
<br>
<input type="checkbox" name="options" value="XYZ17" /> XYZ17
<br>
<input type="checkbox" name="options" value="XYZ18" /> XYZ18
<br>
<input type="checkbox" name="options" value="XYZ19" /> XYZ19
<br>
<input type="checkbox" name="options" value="XYZ20" /> XYZ20
<br>
<br>
Please choose your budget:<br><br>
<input type="radio" name="budget" value="$0-$99" /> Up to $99
<br>
<input type="radio" name="budget" value="$100-$199" /> $100-$199
<br>
<input type="radio" name="budget" value="$200+" /> $200+
<br >
<br >
<input type="submit" value="Submit" />
</p>
</form>
That's just slapped together but it's something like that.
 
You should be able to have one page that dynamically displays the info you want. Look in your PHP book for IF/ELSEIF/ELSE and you can have the page spit out the info you want depending on which check boxes are checked.

IF checkbox 1 is checked = display this "TEXT"
ELSEIF checkbox 1 is not checked = do not display the "TEXT"

Do this for each of your checkboxes.

Good luck with learning PHP, you will find that learning to code dynamic pages will be one of the best decisions you've made when it comes to making money online.
 
Yeah, I know I CAN do it. The question is how difficult is it for a newbie? lol

Anyway, I'll give it a shot! The hard part I'm thinking is that with 20 checkboxes (plus the radio buttons), the number of combinations is huge. I'll have something like 15 variations of a product that will be selected from depending on which of the options are picked. So it's possible there is none that is a perfect fit, but I need to do a best fit to the choices. I have no idea how hard that will be to code, which is why I was considering just having a couple of dozen static pages, each of which offers 2-3 product choices. But, hell, for all I know that's even harder.

Thanks for the help! I really do appreciate it!
 
Well, you ARE looking at a decision tree here.

The number of combinations might be HUGE, the question is if you really need a seperate page for every combination.

See what threehundred said, you can do this easily for form sections where it is just

if a --> spit out text a if b --> display text b

What you need to do is to sit down and look at how many outputs should really be possible.

1024 pages? probably not.

Probably more like 3 pages and some text that changes depending on selection X.

See how to easily detect those decisions.
For example:

If you have a questionnaire with 20 questions, but 1 outcome is really defined by 1 question, REGARDLESS of all the other stuff, you go looking for that answer first.

::emp::
 
Thanks, emp!

No, I definitely don't need a different page for every combination. There are only a couple of dozen results at most. And, yeah, I know what you're saying but I don't think it will work that way with the exception of the radio button choices. They're the only ones that limit the choices in absolute terms.

Let's say they choose options XYZ1, XYZ2, XYZ3 AND XYZ4 and only one of my two dozen results has option XYZ1. It doesn't mean that result should automatically get chosen because it may not have ANY of the other options while another result may have XYZ2, XYZ3 & XYZ4.

In other words, it's a matter of which has the MOST of the chosen options that determines the best result.

I hope this made sense.
 
Status
Not open for further replies.