Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I am using directory_map to get the images inside the folder. But i want to show the images by date modified (in descending order) below is my code
$dir = realpath(FCPATH) . "/assets/images/articles/";
$map = directory_map($dir);
Is there any way to show files in descending order or to get the file info?
I don't see you defining $to anywhere in those lines you posted.
few variables r missing in ur code..
<?php
//these r missing into ur code
$mobile = $_POST['mobile'];
$address = $_POST['address'];
$remarks = $_POST['remarks'];
$to = "abcd#abcd.com";
?>
Could you mention the error please ...?
Also there is no $to variable defined in the code in mail.php
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
enter image description here
show me how to fix this error , although there are quite a few posts but mine is a bit different . I don't understand php well thanks !
details of the error code line: $datainfo['category'] = $category['name'];
The error states that PHP cannot find the key "name" in an array. To counteract the error, you can make the following check and assignment at the point where the array is set.
Many ways to do it:
long version
if (! isset($category['name'])) {
$category['name'] = "";
}
medium long version
$datainfo['category'] = (isset($category['name'])) ? $category['name'] : "";
shortest version
$datainfo['category'] = $category['name'] ?? "";
For handle error, you can write code like:
$datainfo['category'] = (isset($category['name']))?$category['name']:"";
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I am trying to pass some variables through url in php. Im using the following script
$query1 = new ParseQuery("Drivers");
$query1->includeKey("driverUserId");
$query1->descending("createdAt");
$results1 = $query1->find();
$object1 = $results1[$i];
$uname=$object1->get('driverUserId');
echo ''.$uname->get('name').'';
echo '<td>'.$uname->get('name').'</td>';
echo '<td>'.$uname->get('username').'</td>';
But when I execute the page, script stopped working in this line.
echo ''.$uname->get('name').'';
When I removed '.$uname.' it worked fine.
Because if $uname has a ->get() method, it's obviously a class or an object and you can't directly use it like a string (if it hasn't any tostring modifiers). Try to write it like this (just guessing):
echo ''.$uname->get('name').'';
Use the below code:
$id=$uname->get('id');
$name=$uname->get('name');
echo ''.$name.'';
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I'm retrieving the postal code by using -
<?php $pstcde = file_get_contents('https://ipapi.co/'.$_SERVER['REMOTE_ADDR'] . '/postal/'); ?>
It works great but if the postal code is not found, it says, "None". I can't find a way to disable the message.
You can empty the variable if the respond is None. With a simple check.
<?php
$pstcde = file_get_contents('https://ipapi.co/'.$_SERVER['REMOTE_ADDR'] . '/postal/');
if($pstcde === "None")
$pstcde = ""; //Empty string. Or you can use unset($pstcde); if you want to unset the variable.
?>
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a variable posting to another page and when echoed out, it looks like
Acme, Upgrade Site, Kansas
I want to separate those by the comma and assign 3 variable like
$Company = ‘Acme’;
$Action = ‘Upgrade Site’;
$Location = ‘Kansas’;”
$str= 'Acme, Upgrade Site, Kansas' ;
$arr = explode(',',$str);
$Company = $arr[0];
$Action = $arr[1];
$Location = $arr[2];
try
So the best bet here I think is probably to use explode:
// Assume $inputString is your input
$explodedInput = explode(",", $inputString);
// Now, $explodedInput[0] will be Company,
// $explodedInput[1] will be "Upgrade Site", etc...
$Company = $explodedInput[0] //...
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
this is probably an easy question, but I am not really a coder. I maintain a website for a group I belong to, and there are some php forms. I am trying to enhance a form, and I have added this php code, which works (see below). My question is, how can I put this code into a loop so that it repeats 10 times, for "01", "02", etc., "10" strings (code below is for "01" of the series)? Thanks for any help.
//Clean up the Photo Title & Maker Name to remove non-standard chars and replace spaces with underscores and generate a suggested fliename
$photo_01_clean = str_replace(" ","75357",$photo_01_name);
$photo_01_clean1 = str_replace("#","at",$photo_01_clean);
$photo_01_clean2 = preg_replace('/[^a-z0-9]/i', '', $photo_01_clean1);
$photo_01_clean3 = str_replace("75357","_",$photo_01_clean2);
$photo_01_maker_clean = str_replace(" ","75357",$photo_01_maker_name);
$photo_01_maker_clean1 = str_replace("#","at",$photo_01_maker_clean);
$photo_01_maker_clean2 = preg_replace('/[^a-z0-9]/i', '', $photo_01_maker_clean1);
$photo_01_maker_clean3 = str_replace("75357","_",$photo_01_maker_clean2);
$photo_01_filename_gen = $club_code."-01-".$photo_01_clean3."-".$photo_01_maker_clean3.".jpg";
You'd require a for loop control structure. You can find tons of resources that would teach you how to do it. example
Var i;
For (i =1; i<11; i++)
Execute Code here.