What's new

PHP HTML CSS (Image as background)

J P

Journeyman
Joined
Jun 1, 2023
Posts
32
Reaction
0
Points
21
PHP:
</style>
<div class="card card-outline card-info">
    <div class="card-header">
        <h3 class="card-title"><?php echo isset($id) ? "Update Purchase Order Details": "New Purchase Order" ?> </h3>
        <div class="card-tools">
            <button class="btn btn-sm btn-flat btn-success" id="print" type="button"><i class="fa fa-print"></i> Print</button>
            <a class="btn btn-sm btn-flat btn-primary" href="?page=purchase_orders/manage_po&id=<?php echo $id ?>">Edit</a>
            <a class="btn btn-sm btn-flat btn-default" href="?page=purchase_orders">Back</a>
        </div>
    </div>
    <div class="card-body" id="out_print">
        <div class="row">
        <div class="col-6 d-flex align-items-center">
            <div>
            <middle><img src="<?php "C:xampp\htdocs\purchase_order\uploads\JFE_Letterheadtop.jpg"; ?>" alt="JFE_Letterheadtop.jpg" width="1550px" height="150px"></middle>
            </br>
            </br>
            </br>
            </br>
 
The code you provided is written in PHP and is used to generate a card layout with a header and body. It also includes buttons for printing, editing, and going back.

In the header section, there is a conditional statement that checks if the variable $id is set. If it is set, the card title will be "Update Purchase Order Details", otherwise it will be "New Purchase Order".

The card header contains the title and three buttons. The first button has a class of btn-success and an id of print. It uses a font-awesome icon (fa-print) and has the label "Print". The second button has a class of btn-primary and is a link that redirects to a specific page with the id query parameter. The third button has a class of btn-default and is a simple link that goes back to another page.

In the card body, there is a div element with an id of out_print. Inside this div, there is a row with one column. Inside this column, there is another div element with a middle tag. Inside this middle tag, there is an img tag with a source attribute that includes a file path to an image file (JFE_Letterheadtop.jpg). The image is specified with a width of 1550 pixels and a height of 150 pixels.

However, there is an issue with the image source path. Currently, it is set to <?php "C:xampp\htdocs\purchase_order\uploads\JFE_Letterheadtop.jpg"; ?>. This is not a valid PHP code as it is missing the echo statement. To fix this, you should change it to <?php echo "C:xampp\htdocs\purchase_order\uploads\JFE_Letterheadtop.jpg"; ?> so that the image source path is correctly echoed out.
 
The code you provided is written in PHP and is used to generate a card layout with a header and body. It also includes buttons for printing, editing, and going back.

In the header section, there is a conditional statement that checks if the variable $id is set. If it is set, the card title will be "Update Purchase Order Details", otherwise it will be "New Purchase Order".

The card header contains the title and three buttons. The first button has a class of btn-success and an id of print. It uses a font-awesome icon (fa-print) and has the label "Print". The second button has a class of btn-primary and is a link that redirects to a specific page with the id query parameter. The third button has a class of btn-default and is a simple link that goes back to another page.

In the card body, there is a div element with an id of out_print. Inside this div, there is a row with one column. Inside this column, there is another div element with a middle tag. Inside this middle tag, there is an img tag with a source attribute that includes a file path to an image file (JFE_Letterheadtop.jpg). The image is specified with a width of 1550 pixels and a height of 150 pixels.

However, there is an issue with the image source path. Currently, it is set to <?php "C:xampp\htdocs\purchase_order\uploads\JFE_Letterheadtop.jpg"; ?>. This is not a valid PHP code as it is missing the echo statement. To fix this, you should change it to <?php echo "C:xampp\htdocs\purchase_order\uploads\JFE_Letterheadtop.jpg"; ?> so that the image source path is correctly echoed out.
It still dont work after I added echo in the statement. :(
 
It still dont work after I added echo in the statement. :(
I apologize for the confusion. If the image is not displaying after adding the echo statement, there might be a problem with the image source path or the file itself. Here are a few steps you can take to troubleshoot the issue:

1. Verify the image path: Ensure that the image file is located at the specified path (C:xampp\htdocs\purchase_order\uploads\JFE_Letterheadtop.jpg). Double-check the file name, folder structure, and capitalization.

2. Check file permissions: Make sure that the image file has the necessary read permissions for the web server to access it. Check the file permissions and ensure that the web server user has the necessary access rights.

3. Verify the image file format: Confirm that the image file is in a supported format (such as JPEG, PNG, or GIF) and that it is not corrupted. Try opening the image directly in a web browser or an image viewer to ensure it is valid.

4. Check the web server configuration: Ensure that the web server (e.g., Apache, Nginx) is properly configured to serve static files from the specified directory. Check the server configuration files and make sure there are no restrictions or misconfigurations.

5. Use absolute URL: Instead of using a relative file path, try using an absolute URL for the image source. For example, you can use /purchase_order/uploads/JFE_Letterheadtop.jpg instead of the full file path. This can help avoid any path-related issues.

6. Test with a different image: Try using a different image file to see if the issue is specific to the original image file. This can help determine if the problem lies with the image file itself.

By following these steps, you should be able to identify and resolve the issue causing the image not to display.
 
Thanks for your suggestions. But, is it possible to use a background image then text are in front?
 

Similar threads

Back
Top