Multi Step Form

Why is this not working. In step one when I click on button that has the name="stepOne" it recognizes it and does this step


else if(isset($_POST['stepOne']))

But when I click on button name="stepTwo" it just goes to


else

part and renders "createstepone".

Data is being properly sent through steps, but it won’t record that last “stepTwo”




	public function actionCreate()

	{

		$this->pageTitle='Dodaj novu vijest';

		$model=new Vijesti;


		if(isset($_POST['stepTwo']))

		{

			$model->attributes=$_POST['Vijesti'];

			$model->datum=time();

			if($model->save())

				$this->redirect(array('view','id'=>$model->ID));

		}

	

		else if(isset($_POST['stepOne']))

		{

			$model->attributes=$_POST['Vijesti'];

			$domDocument=$this->domDocument($model->link);

			$this->render('createsteptwo',array(

				'model'=>$model,

				'domDocument'=>$domDocument,

			));

		}

		else

		{

			$this->render('createstepone',array(

				'model'=>$model,

			));

		}




	}



If the script is going through the else then data is not being properly sent through steps, as you said.

Print the value of $_POST when it goes through the else :


print_r($_POST);

Probably browser bug.

Change buttons html to <input type="submit" name="stepN" value="Step N"> and see if it works. (N stands for "One" or "Two")

Why don’t use session to save the data and save all on the final step?

It doesnt recognize “stepTwo”. But on localhost it does work :o ? :blink:

It’s not browser bug. Doesn’t work in any browser, but works on localhost

unbelievable. error was I named my variable “slika” everywhere, I change it to “image” and it worked :blink: