Wondering if we can do this

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
irishmike2004
Forum Contributor
Posts: 119
Joined: Mon Nov 15, 2004 3:54 pm
Location: Lawrence, Kansas

Wondering if we can do this

Post by irishmike2004 »

Greetings:

I have a PHP page that I am working on that has multiple forms on one page. (I am open to another way of doing this if we can find it).

The first form queries the database and dynamically creates a dropdown of possible people to select from (this form's action is PHP_SELF).

Now the second form is poplulated from another table in the database and has it's own submit button which launches a "processing page" to update or create a row in the database. The default "mode" of the form should be UPDATE with an option to change the "mode" to ADD on the fly.

If I have successfully described the page, then the question is how can I change the variable (in this case I named it $formState) to "0" which is my flag for "Add". It needs to default to "1" unless a button or link is selected and that link should change the $formState variable to "Add" (0) from "Update" (1)... the trick has been trying to make this button (or href) work and I would prefer NOT to use JavaScript to do it, but I will if that is the easiest way. BTW: I don't want to reload the page to do this.

Please advise if you would like to see the code for the page as it stands.

Thanks,

Mike
User avatar
andyhoneycutt
Forum Contributor
Posts: 468
Joined: Wed Aug 27, 2008 10:02 am
Location: Idaho Falls

Re: Wondering if we can do this

Post by andyhoneycutt »

I might be a little thick, but I am pretty sure there isn't really another solution to your problem other than using javascript to set the value of the form's member on the fly (without a postback, anyhow).

-Andy
Post Reply