Hi,
it's an excellent forum; just what I was looking for.
My request is enough specific:
I'm programming in a system MVC (Model View Controller) in wich I display a view, in this view there is a <form> that is defined to redirect the user on the same Class, like this:
(the user is in ControllerForm.php)
<form action="./ControllerForm.php" method="post"></form>
but I had create an object wich I would like to use again with the same "attribut" (I dont know how to say in english: just like <protected $name;>) but I really have no idea how to keep my object with redirecting or just stay in this object from layout and use another function of the class.
Thank's from advance for your answers!
Dimitry
redirect <form> to a method on php Object-oriented programming - system MVC
Started by inconu8500, Mar 17 2011 01:58 PM
2 replies to this topic
#1
Posted 17 March 2011 - 01:58 PM
|
|
|
#2
Posted 20 March 2011 - 02:38 AM
You could use a session to do this.
What framework (if any) do you use? In most cases people implement a class to manage sessions with so called flash-data - a session variable that is unset after the next page request is finished.
What framework (if any) do you use? In most cases people implement a class to manage sessions with so called flash-data - a session variable that is unset after the next page request is finished.
#3
Posted 22 March 2011 - 07:37 AM
Hi,
thank's for your answer, I talk with some friends hwo said the same.
It's working fine now.
I have another problem... more difficult this time, really... and I don't know how to do this:
I'v got a formular in wich I propose some dates with checkboxes. Some of the values displayed here are a part of the data base.
I woul'd like to put
Have a nice day.
Dimitry
thank's for your answer, I talk with some friends hwo said the same.
It's working fine now.
I have another problem... more difficult this time, really... and I don't know how to do this:
I'v got a formular in wich I propose some dates with checkboxes. Some of the values displayed here are a part of the data base.
I woul'd like to put
checked="checked"into input that comes from data base, but only if the user hadn't changed it. I use my local session to save the choices (and I don't save the data into database for the moment), but anytime I come back on this page the values aren't those which I choosed (only by default which are in data base):
//$dates is an array() that contains the dates proposed
//$choix is an array() that contains the dates from the data base
//$_SESSION["choix"] is a condition, if isset, that means the user had already choosen, in this case it should ignore data from data base...
//$_SESSION["check_"$b] is the checkbox the user had choosen
//$page is my page, i display
//display dates
$a=0;
for ($b=0; $b<=9; $b++)
{
if (isset($dates[$b]))
{
if (isset($_SESSION["choix"]))
{
if (isset($_SESSION["check_".$b]))
{
if ($_SESSION["check_".$b]==$dates[$b])
{
$page .= '<input type="checkbox" name="check_';
$page .= $b.'" value="'; $page .= $dates[$b].'" checked="checked"/>';
}
else
{
$page .= '<input type="checkbox" name="check_';
$page .= $b.'" value="'; $page .= $dates[$b].'"/>';
}
}
else
{
$page .= '<input type="checkbox" name="check_';
$page .= $b.'" value="'; $page .= $dates[$b].'"/>';
}
}
else if ($choix[$b]==$dates[$b])
{
$page .= '<input type="checkbox" name="check_';
$page .= $b.'" value="'; $page .= $dates[$b].'" checked="checked"/>';
}
else
{
$page .= '<input type="checkbox" name="check_';
$page .= $b.'" value="'; $page .= $dates[$b].'"/>';
}
$page .= $dates[$b]."<br>";
}
}
If you have any idea, it will help me I'm shure.Have a nice day.
Dimitry
Edited by inconu8500, 22 March 2011 - 07:44 AM.
error in code
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









