Jump to content

passing an array into a class varaible


TheOne17

Recommended Posts

I am trying to write a form create validate class, but I have very little experience with OO in PHP.

 

class form

{

public $form_output;

private $form_submitted;

public $Hidden_name;

public $submit_name;

public $post_array;

private $required_data;

private $error1 = "You have not filled in all the required fields";

 

function __construct($inMethod, $inFormTo, $inFormSubit, $inHiddenName, $inSubmitName, $inPost)

{

$this->form_submitted = $inFormSubit;

$this->Hidden_name = $inHiddenName;

$this->submit_name = $inSubmitName;

$this->post_array = &$inPost;

$this->required_data = true;

if($inMethod == "post")

{

$this->form_output = '<form action="'.$inFormTo.'" method="'.$inMethod.'" enctype="multipart/form-data">';

}

else

{

$this->form_output = '<form action="'.$inFormTo.'" method="'.$inMethod.'">';

}

}

 

I am trying to past the $_POST array for use withing the class. I have tried the above which doesn't appear to work for arrays?

Not sure if I am doing something silly are just missing some knowledge.

Thanks in advance for any help

Link to comment
https://forums.phpfreaks.com/topic/37743-passing-an-array-into-a-class-varaible/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.