Welcome Guest, Not a member yet? Register   Sign In
I want to create a comment form with CI!!
#1

[eluser]ngatcharius[/eluser]
hello All!!
I am new in CI. I want to create a comment form in some of my web pages how will i do? because URI is look like www.exemple.com/param1/param2/param3.
i need your help please!
#2

[eluser]InsiteFX[/eluser]
Read the CodeIgniter Users Guide Form_Validation

InsiteFX
#3

[eluser]Djordje Zeljic[/eluser]
Also see form_helper...
#4

[eluser]ngatcharius[/eluser]
i know how to use form in CI i will explan you my plan

<here my picture>
<my comment form [with captcha]>
<here list of comment>

$this->url = www.exemple.com/show/picture/$id_picture

in view form i put current_url() in form_open() [it is good ?]
1 - went i post my form i don't see error messages
2 - i put an 'echo' in
Code:
if ($this->input->post('comment'))
but i see nothing !

i'm waiting for your post!
thanks in advance
#5

[eluser]Djordje Zeljic[/eluser]
Code:
&lt;?
  if($this->input->post('comment')){
  echo 'Comment: '.$this->input->post('comment');
  }
?&gt;
&lt;?=form_open(current_url())?&gt;

<label>&lt;?=form_input('comment')?&gt;</label>

&lt;?=form_submit('add_comment','Add Comment')?&gt;

&lt;/form&gt;

Try to run this code.
#6

[eluser]ngatcharius[/eluser]
thanks {Djordje Zeljic} it works!! you reply quickly
please how to empty post if form_validation->run() is true?
#7

[eluser]Djordje Zeljic[/eluser]
if you think how to empty $_POST?
Code:
unset($_POST);
or
Code:
$_POST = null;
and, why you need to empty "post"?
#8

[eluser]ngatcharius[/eluser]
after post a comment i need to empty all post of the form! that is to prevent user to repost same value!
#9

[eluser]WanWizard[/eluser]
That doesn't really help, POST information comes from the client. If the user reloads his browser, or uses the back button and submits the form again, you'll get a new POST array with all the form values...

The only safe way to prevent this is to add a token to the form, and check using a form validation rule if the token in the submitted form has been used before. If so, it's a double post. You can use that same token for CSRF protection.
#10

[eluser]Unknown[/eluser]
Me too!i need to empty all post of the form! that is to prevent user to repost same value!




Theme © iAndrew 2016 - Forum software by © MyBB