0

I am using CodeIgniter for PHP. Can anybody tell me why is this code not working properly?

  <form action="/TestCodeIgniter/index.php/blog/comment_insert/<?php $this->uri->segment(3);?>" method="post">

However, this code works fine :-

<?php echo form_open('blog/comment_insert/' . $this->uri->segment(3) ); ?>

I am very much sure that segment(3) exists in my pretty url. Then how come if i use plain HTMl my php code doesn't get embedded?

Thanks in advance :)

0

1 Answer 1

7
<?php $this->uri->segment(3);?>

Unless the segment method has the side effect of echoing something, this won't generate any output. It probably returns a string instead, which you should ouput with echo:

<?php echo $this->uri->segment(3);?>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.