0

I have a php code as shown below in which I want to concatenate strings in php coming from the database table.

$record['INFO']['PATH_FILE'] = A:\RW\YVR;

$record['INFO']['FILE_NAME'] = abc.doc;

On concatenation, I want the string to look like this A:\RW\16may05\abc.doc (I want to open/download a file on the click as its href)

This is what I have tried:

echo '        <td rowspan="'.$hello_world.'"><a href="'.$record['INFO']['PATH_FILE'].'"\"'.$record['INFO']['FILE_NAME'].'">'."\n";   // Line A

On inspect, I am seeing in the following format:

"A:\RW\YVR\abc.doc" \""=""

Problem Statement:

I am wondering what changes I need to make at Line A so that I see in the following format "A:\RW\YVR\abc.doc" or in the format in which users can open or download.

1 Answer 1

3

The backslash will escape the next character, so you need to escape the backslash by using 2 backslashes

echo '<td rowspan="'.$hello_world.'"><a href="'.$record['INFO']['PATH_FILE'].'\\'.$record['INFO']['FILE_NAME'].'">'."\n";   // Line A
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.