Click to See Complete Forum and Search --> : OK... Let's try this... PHP Form Help.


Raskii
09-18-2001, 05:07 PM
I've given up the sending information back to the "parent" window idea and have decided to try a little more... standard method of creating my form.

I still have a problem though. I want to be able to modify items individually (if there are three things you've added to the form, I want you to be able to go into a "Modify" page and delete or change ONLY that item. If you delete that item, you'll still have the other two on the list).

Is this simply done by nesting forms? Can I have one big form that will be used for the actual "purchasing" and have each item in the list a sub form? Is there a better way to do this? :confused:

Stuka
09-19-2001, 11:23 AM
I'm not completely sure I know what you're trying to do, but could you keep the important data in an object, and use sessions to make the object persistent, then use the form as its own target, with modifications occurring based on what parameters were passed?

Raskii
09-20-2001, 10:40 AM
How do I make an object in PHP? I know how to use sessions, but I don't know enough "advanced" programming to do objects. Do you know of any (simple) examples?

Stuka
09-20-2001, 10:59 AM
The syntax is fairly simple:clase MyClass{
var $foo;
var $bar;

function myFunc($param1, $param2){
$foo = $param1/$param2;
$bar = $param2/3;
}

function MyClass($param1, $param2){
$foo = $param1;
$bar = $param2;
}
}This will let you then declare objects of the class like so:$myObject = new MyClass(1, 2);
$myObject->myFunc(3,6);
print($myObject->foo);
print($myObject->bar);If you want to use this on multiple pages, just pull the class definition out into a file, and include it in every important page (if using sessions to save your objects, you've gotta do it before you call session_start()). Hope this helps!