[nycphp-talk] Automatically create an object from a form
Chris Bielanski
Cbielanski at inta.org
Tue Oct 19 11:48:16 EDT 2004
sure, in javascript make an if tree (Remember it's 'else if' with the space)
or switch-case construct,
inside each case put the PHP code for the desired constructor...
if(document.formname["controlname"].value) == "X")
{
<?
var $classX = new classX($parm);
?>
}
else if(document.formname["controlname"].value) == "Y")
{
<?
var $classX = new classY($parm);
?>
}
else
{
...
}
Syntax might be wrong a smidge here of there, YMMV.
Thanks,
Chris Bielanski
Web Programmer,
International Trademark Association,
1133 Avenue of the Americas, 33rd Floor
New York, NY 10036
+1 (212) 642-1745, f: +1 (212) 768-7796
mailto:cbielanski at inta.org, www.inta.org
INTA -- 125 Years of Excellence
> -----Original Message-----
> From: Christopher Merlo [mailto:cmerlo441 at gmail.com]
> Sent: Tuesday, October 19, 2004 11:37 AM
> To: NYPHP Talk
> Subject: [nycphp-talk] Automatically create an object from a form
>
>
> Hello, folks. I'm not sure that what I want to do is possible. If it
> is, I'm sure it takes a lot more JavaScript than I know (which is
> precious little).
>
> PHP 4.3.2 on Apache on Linux. I would like to create an object of a
> PHP class by choosing an element from an HTML select drop-down box,
> and using the selected value to specify a parameter to the object's
> constructor. (Then, if the selection changes, throw out the old
> object, and create a new one in its place, with the newly-selected
> value being sent to the constructor.)
>
> Can I do this? TIA,
> -c
>
> --
> cmerlo441 at gmail.com
> _______________________________________________
> New York PHP Talk
> Supporting AMP Technology (Apache/MySQL/PHP)
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.newyorkphp.org
>
More information about the talk
mailing list