Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

best way to include content from another file

Featured Replies

Hey all,
I have a form thats action is another page..

 

<form class="indexSearch" action="search.php" method="post">
 

 

to keep my code neat im keeping all my php code in a seperate file that im including in the head of every page...

 

<head>

<?php include'include/includes.php';?>
</head>
 

 

the problem im having is when the php code in the includes.php file runs it echos at the top left hand corner of the page I want it to appear on and im confused at the best way to make it appear where I need it

 

<?php



if(isset($_POST['indexSearchSubmit']))

{
    foreach($_POST['industryList'] as $selected)
        {
            $_POST['industryList'] = $selected;
            $locationListResults = $_POST['locationList'];


            $results = mysqli_query($con,"SELECT * FROM currentListings WHERE location = '$locationListResults' AND industry = '$selected'");


            while($row = mysqli_fetch_array($results))
                {
                    echo $row['industry'];
                    echo "<br>";
                    echo $row['location'];
                    echo "<br>";
                    echo $row['title'];
                    echo "<br>";
                    echo $row['description'];
                    echo "<br><br>";
                }
        }
                    mysqli_close($con);
}


?>
 

 

Any help would be greatly appreciated.
Thx

Edited by webdesigner93
Use the code tags please.

I can't particularly help as PHP is not my forte however if you put the code in code tags it would make it more readable on here.

 

Example

 

if you want it to echo in a certain area then use AJAX not only it is dynamic it also sets where this echo procedure will output for example is you wanted it to output in the center you just put a div id there and it will simply find that id and put the code there. I used a a guy on youtube which had tutorials of how to use AJAX.

 

heres the link if your interested, I got to number ten and then I understood it.

 

To make your code appear where you need it then include the file where you need it. Obviously putting

 

<?php include ('include/includes.php');?>
 

 

in the head section is going to put your code in the head section.

Edited by webdesigner93

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.