Jump to content

Loading A Part Of A Page Without Refreshing


ChrisPHP

Recommended Posts

Hey all,

 

Hope your doing all fine...

Ok my next idea is that I have this page that it contains a content. Whenever i click something in menu it loads the proper page inside the content. But when I click a button with the method POST it redirects the whole page and not the content only.

I want to display if a driver is successfully added or not inside the same page!!

 

 

Code of Admin.php:

 


include("Conx.php");
if(isset($_POST['AName']) && isset($_POST['CEOName'])&& isset($_POST['Address']) && isset($_POST['AEmail']) && isset($_POST['ATel'])){
$target = "images/"; 
$target = $target . basename( $_FILES['AImage']['name']);
$an=$_POST['AName'];
$cn=$_POST['CEOName'];
$a=$_POST['Address'];
$ae=$_POST['AEmail'];
$at=$_POST['ATel'];
$file=$_FILES['AImage']['tmp_name'];
$sql="INSERT INTO agence(agID,nom_loueur,adresse,email,tel,AImage)values('".$an."','".$cn."','".$a."','".$ae."','".$at."','".$file."')";


if(move_uploaded_file($_FILES['AImage']['tmp_name'], $target)){
$res=mysql_query($sql) or die(mysql_error());
header('location: ../Admin.php?add');
}else{ 
echo "<html><font size='4' color='white'><b>Can't insert..</b></font></html>";
}

}

 

 

 

 

and in the main page Admin.php added:

 


if(isset($_GET['add']))
{
echo "<html><center><font size='4' color='white'><b>Successfuly added!!</b></font></center></html>";
}else{

echo"<html><center><font size='4' color='white'><b>Welcome to Admin's page!!</b></font></center></html>";
}

 

 

 

 

I know that this way gives the result on Admin.php and not inside the content in page chosen...

 

Thanks in advance

Link to comment
Share on other sites

  • 2 weeks later...

I'm not sure what your definition of "driver" is but it sounds like you want to test if content is loaded?

 

You can use jQuery as it simplifies things - may be overkill for one task though - or alternatively write a small object to create the request etc. Can't really help other than that as you've not attempted anything.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.