Jump to content

Retain Values in form after redirect


anujgarg

Recommended Posts

Hi,

 

I am using a form in joomla that after submitting is being redirected to the same page containing form. I am also using server side validations into it. My problem is: when a server side validation occurs after submitting a form with a blank field, then I lose my form values that I filled before submitting the form.

 

This is what I am using:

$row->pkg_name = JRequest::getVar( 'pkg_name', '','post', 'string', JREQUEST_ALLOWRAW );
      $row->int_desc = JRequest::getVar( 'internalDesc', '','post', 'string', JREQUEST_ALLOWRAW );
      $row->ext_desc = JRequest::getVar( 'externalDesc', '','post', 'string', JREQUEST_ALLOWRAW );

if($row->pkg_name == "")
         $msg = "Package Name must have a value";
      else if($row->price == "")
         $msg = "Price must have some value";
      else if(!is_numeric($row->price))
         $msg = "Price must have numeric value";

switch($show)
         {
            case '1':
              $msg  = 'Package Modified';
              break;
            case '0':
              $msg  = 'Package could not be modified.';
              break;
            default:
         }

$this->setRedirect($link, $msg);

The form is being redirected to the same page containing form but all values lost.

 

How can I retain them? Please suggest...

 

Thanks

Anuj

Link to comment
https://forums.phpfreaks.com/topic/194650-retain-values-in-form-after-redirect/
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.