Welcome Guest, Not a member yet? Register   Sign In
Generate a random URL to a specific page
#11

[eluser]Samus[/eluser]
Make your redirect
Code:
redirect(current_url());

Also make sure you're posting the data to that actual page, it will still trigger your signup_unite method.

If you use the form helper you'd just have to open it and it'd post to that actual page, e.g

Code:
<?php echo form_open(); ?>
{/code]

Or in plain html

[code]
<form method='post' action='user/signup_unite/00u8b0pir'> // you could make thisd dynamic

Better to use form_open() imo.
#12

[eluser]Omaplie[/eluser]
Hi,

Thanks for your quick answer.
But the trouble is that I use something like this in my controller :

Code:
<?php
    function signup_unite()
    {
        //LOAD VIEW
        $layout['content'] = $this->load->view('signup_unite', $data, TRUE);
        $this->load->view('layout',$layout);
        
        if($this->form_validation->run())
        {
            //ACTION IF FORM IS OK
        }
        else
        {
            // ACTION IS FORM IS NOT RUNNING
            redirect(current_url());
        }
    }
?>

The trouble is that the redirect is done when I arrive on the page.
I would like that the else be launch only when there is a trouble with the form.
And unfortunately, I think that
Code:
redirect(current_url());
doesn't work.

Thank you for your help.
#13

[eluser]Samus[/eluser]
Actually you don't even need to redirect it at all.

If youre submitting to the current controller it will redirect anyway.

I'm on my phone so can't really write code. But only use the else portion if you want to perform some action when there are errors.
#14

[eluser]Omaplie[/eluser]
Yes but it's redirect to /user/signup_unite.
I lose the random string after and that's bring me to a « 404 page »

Ok, no worries, thank you for your help
#15

[eluser]Samus[/eluser]
As said as long as your form posts to user/signup_unite/00u8b0pir you won't lose the random url
#16

[eluser]Omaplie[/eluser]
I am too stupid !!
Thank you very much !!




Theme © iAndrew 2016 - Forum software by © MyBB