I am using codelgniter and i want to pass the below 3 parameters to site_url().But this take only the method name not the parameters.... How can i pass these parameters. Please help me
function report_del() {
$island = $this->tables($this->input->post('island'));
$prefix = $this->tables($this->input->post('prefix'));
$date = $this->tables($this->input->post('date'));
redirect(site_url('admin/admin/dateandprefix/').$date.'/'.$prefix.'/'.$island);
//$segments = array('admin/admin/dateandprefix/',$date,$prefix,$island);
//redirect(site_url($segments));
}
If the code is copy pasted, there is an error in the single quote
redirect(site_url('admin/admin/dateandprefix/').$date.'/'.$prefix.'/'.$island);
you are making a mistake . use site url like this .
redirect(site_url('admin/admin/dateandprefix/'.$date.'/'.$prefix.'/'.$island));
for more details you can view this link
user guide
Hope this help.
Try this :
redirect('admin/admin/dateandprefix/'.$date.'/'.$prefix.''.$island.'','refresh');
If you are using CI4
Then use in base use and/public after that
http://localhost/foldername/public
then it work fine
Related
Can I use header to pass multiple parameters or just one?
I am trying to implement this but its not working, It doesn't navigate:
$selected_company = $_POST['company_name'];
$company_type = $_POST['company_type'];
$url_param = "comp_id=$selected_company&comp_type=$company_type";
header("location: ./create_user.php?$url_param");
Whats wrong with the code I am using?
If I want to pass only want parameter I can do it like this and it works:
header("location: ./create_user.php?$selected_company");
P.S. it is so strange that I was not able to find one single working solution to this, I assumed this is a very common issue.
Try out this and it worked for me:
<?php
$selected_company = $_POST['company_name'];
$company_type = $_POST['company_type'];
$url_param = "comp_id=$selected_company&comp_type=$company_type";
header("location: ./create_user.php?".$url_param);
?>
Also checkout the value coming from POST parameters;
I´m having issues with a link that is created in a php controller (Yii Framework). The link must be like this: https://example.com/track/?id=HDkuY0je9d (HDkuY0je9d is a tracking code) but when the view is rendered i get https://example.com/track/?id=h-dku-y0je9d
PHP is adding dash delimited automatically.
$trackcode = $val['tracking'];
$url_tracking = Yii::app()->createUrl("/track/?id=".$trackcode);
$tracking = 'Tracking';
If you are using Yii2 in this, it has helper class for create url and url must have been
$url_tracking = yii\helpers\Url::to(['/track','id'=>$trackcode]);
and for generate link
<?=\yii\helpers\Html::a('Link description',$url_tracking,['target'=>'_blank']) ?>
Thanks, I solved changing the way i get app url. Changed
$url_tracking = Yii::app()->createUrl("/track/?id=".$trackcode);
for
$url_tracking = websiteUrl()."/track/?id=".$trackcode;
Ok so I have the code for a form that is called and works but it needs two varibles grabbed from the string of a url. I have the first and the second is the same for what im doing on any page that I am creating which is alot. Here is the code at the url: collabedit.com/9g99j
Question if Get <?php echo $_GET['id']; ?> is grabbing my id string from the url how do I use this in the echo of my function I just defined at the bottom of the code? Instead of having this: echo DescriptionGet(1256124, 50874); can someone tell me how to put something like this: echo DescriptionGet(1256124, $id);
This would make it so i dont' have to enter that id value for every page I want to create.
Thanks,
Thanks everyone for your replies and I was able to figure it out on my own and actually used exactly what the first reply was.
Now I have a new question about this function. How do I make it grab the image from that same page its grabbing the form code from? I can't figure this part out and its keeping me from doing mass automation for this site.
Anyone help?
Try this:
$id = $_GET['id'];
echo DescriptionGet(1256124, $id);
You can change your function definition from:
function DescriptionGet($c, $id)
to
function DescriptionGet($c, $id=50874)
Each time when you will call DescriptionGet($c) it will behave as you passed $id=50874 but also if you need you can call DescriptionGet($c, 20) and $id in the function will be set to 20.
And in case you want to simple use $_GET['id'] as function parameter you can simple run
echo DescriptionGet(1256124, intval($_GET['id']));
you don't even need to use extra variable.
echo "<li><a href=\"#\" onclick='load_page_device(\"mg-device.php?device=device_name&sensor=$p1_url\")'>".$row['p1_name']."</a></li>";
Alright I simply trying to pass two variables in a url via a php echo statement. It's simply not working.
I am then using
$device_name = $_GET['device'];
$sensor_name = $_GET['sensor'];
I have tried also to use & instead of & only. The first variable always seems to get passed but the second one never does. Any help is greatly appreciated I have been trying to get this to work for hours now. Thanks!
try
echo '<li>'.$row['p1_name'].'</li>';
you need to first check that $_GET['device'] , $_GET['sensor'] is set
try
if(isset($_GET['device']) && isset($_GET['sensor'])){
//stuff
}else{
//other stuff
}
Hey guys, I'm using Twitter's PHP API, called twitterlibphp, and it works well, but there's one thing that I need to be able to initiate, which is the linking of URLs and #username replies. I already have the function for this written up correctly (it is called clickable_link($text);) and have tested it successfully. I am not too familiar with parts of twitterlibphp (link goes to source code), and I am not sure where to put the function clickable_link() in order to make URLs and #username's clickable. I hope that is enough information, thanks a lot.
EDIT:
In addition, I would like only one status to come up in the function GetFriendsTimeline(), right now 20 come up, is there any easy way to limit it to one?
I would extend the Twitter class and put the functionality in my own getUserTimeline method.
class MyTwitter extends Twitter
{
public function getUserTimeline()
{
$result = parent::getUserTimeline();
// Your functionality ...
return $result;
}
}
You don't need to put clickable_link() in twitterlibphp. Instead, call it right before you output a status message. Example:
$twitter = new Twitter('username', 'password');
$result = $twitter->getUserTimeline();
... parse the $result XML here ...
echo 'Status : '.clickable_link($status);