November 18, 201312 yr 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 November 18, 201312 yr by webdesigner93 Use the code tags please.
November 18, 201312 yr 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
November 18, 201312 yr 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.
November 19, 201312 yr 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 November 19, 201312 yr by webdesigner93
Create an account or sign in to comment