smita jagtap
smita jagtap

Reputation: 1

getting error while using base_uri() in href

I am trying this, but it does not work.

echo "<a  class='btn btn-info btn-md' href='<?php echo base_url();?>index.php/Welcome/editvendor/$row->VendorId'>Edit</a>";

URI does not get loaded.

Upvotes: 0

Views: 333

Answers (5)

Giri Annamalai M
Giri Annamalai M

Reputation: 809

Try this:

echo "<a class='btn btn-info btn-md' href='".base_url()."index.php/welcome/editvendor/".$row->VendorId."' > Edit </a>";

Upvotes: 0

Vali S
Vali S

Reputation: 1461

If you default controller is welcome (in /config/routes.php $route['default_controller'] = "welcome";), then your links should look like this when you use base_url():

"<a class='whatever' href='". base_url() ."'editvendor/'".$row->VendorId."'>Edit</a>"

Upvotes: 0

Abdulla Nilam
Abdulla Nilam

Reputation: 38652

Your echo statement should be

echo "<td> <a class='btn btn-info btn-md' href='". base_url() ."'index.php/Welcome/editvendor/'.$row->VendorId.'">Edit</a></td>";

Then in config/config.php

$config['base_url'] = '';
$config['index_page'] = '';

And in config/autoload.php

$autoload['helper'] = array('url');

Upvotes: 0

parth
parth

Reputation: 1868

try this

<td> <a class='btn btn-info btn-md' href="<?php echo base_url('index.php/Welcome/editvendor/'.$row->VendorId); ?>">Edit</a></td>

Upvotes: 0

davcs86
davcs86

Reputation: 3935

Use

echo "<td><a class='btn btn-info btn-md' href='".base_url("/Welcome/editvendor/".$row->VendorId)."'>Edit</a></td>";

Upvotes: 2

Related Questions