Code Comments
Programming Forum and web based access to our favorite programming groups.At present I have webpage which is just a selection of 5 forms which
pass informaton to a .php files which update individual fields in a
database - i.e. price, details, type etc.
At present I'm using separate files for each form, which works well, but
I'm thinking about almalgamating them into one, which would be a more
elegant way of doing it.
I was going to use the switch function and then activate the required
code depending on which information was sent.
I can't figure out how to get the value of the sent information into the
switch variable.
Can anyone help?
TIA, Russ
pseudo code something like this:
<?php
$flag = value sent - could be $newdetail, $newprice etc..;
switch ($flag){
case $newprice:
action this code;
break;
case $newdetails:
action this code;
break;
etc...
}
?>
--
take out the trash to email
Post Follow-up to this messageYou can use named "submit" inputs and decide what was submited by checking which variable is set (coresponding to which button). You may also use form names (when "submit" button is not named, and form is, then the browser should send "submit" button value under the form name). Hilarion
Post Follow-up to this messageHilarion wrote:
> You can use named "submit" inputs and decide what was submited by checking
> which variable is set (coresponding to which button). You may also use
> form names (when "submit" button is not named, and form is, then the brows
er
> should send "submit" button value under the form name).
>
> Hilarion
>
>
Yep, obviously to close to it for too long... thanks,
coded as
switch (TRUE){
case $newprice:
action this code;
break;
case $newdetails:
action this code;
break;
etc...
works well!
R.
--
take out the trash to email
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.