PHP Form Errors

Dear Everyone,

All three “header” lines are giving me error messages - any idea why? I believe everything else is set up correctly.

Thank you!!
Chava Drummond

[php]

<?php $var = $_GET['choice']; if($var == 'hall'){ header("Location: hall_questions.html"); }else if ($var == 'photo_video'){ header("Location: photo_video_questions.html"); }else if ($var == 'musician'){ header("Location: musician_questions.html"); }else { header("Location: contact.html"); } ?>

[/php]

everything seen correct.
can you post the error you getting?

Dear wilson382,

Thanks so much for your reply. I’m using Dreamweaver as my code editor, and it says that those lines have an error but isn’t specific. I uploaded the page to the server, and it’s also giving me an “internal error” when I try to access the page directly (the form it’s connected to is of course also not working); I called the hosting company and they said there’s something wrong with the code…

Chava

well that block of codes have no errors, maybe some codes that you did not show have errors?

The only problem I can think of is $_GET[‘choice’] is not set it would echo an error causing the header() to fail.

Does this help?

[php]
$var = (isset($_GET[‘choice’]) ? $_GET[‘choice’]: ‘’);
[/php]

Dear m@tt and wilson382,

Thank you so much; I have no idea what’s going on, so I think I’ll end up asking the programmer who helped me set it up in the first place!

Chava

One thing to check with dreamweaver (i use it also), when you save the file, make sure that checkbox on the bottom (something about the DOM character) isn’t checked. That one threw me for a loop when i first started using it. Also, you can open the php file in a regular text editor (like notepad) and then save it again. that’ll get rid of that DOM character.

I don’t recommend dreamweaver for any reason. If you really want to be a programmer you have to force yourself to learn to code from nothing - never use a helper program.

Personally, I do all my code with pnotepad. (http://www.pnotepad.org)

Dreamweaver has 3 ways of viewing it, you can do it visually, split screen, or with pure code. I use it just because its what i started out. I like php editor from nusphere though, i’m just not going to pay for it.

I recommend also using Netbeans IDE and notepad++(My favorite)

I’ve used notepad++, good program for if you’re just starting out :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service