Jump to content

[SOLVED] Make something appear after query


mike12255

Recommended Posts

<?php
include ("connect.php");
session_start();
if (!$_SESSION['user']){
header("Location: login.php");
}

if (isset($_POST['submit'])){


$target_path = 'pfd/';

$target_path = $target_path . basename( $_FILES['file']['name']); 

$wantedname = $_POST['name'];



if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
   
$sql = "INSERT INTO catagories (Name,wantedname) VALUES ('$target_path','$wantedname')";
mysql_query ($sql) or die (mysql_error());?>
//Make this div appear once file has been moved
    <div id="loaded" style="display:none;"><img border="0"  src="images/good.png">Sucsess! You May now continue</div>
    
    <?php

} else{
    echo "There was an error uploading the file, please try again!";
}



}else{
//die($name);

}

?>
<html>
<head>
<title>Administration Center</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
color: #D7D0B8;
}
body {
background-color: #D7D0B8;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}


#load{

z-index:1;
text-align:center;
font-family:"Trebuchet MS", verdana, arial,tahoma;
font-size:18pt;
padding-right:20px;
}

#loaded{

z-index:1;
text-align:center;
font-family:"Trebuchet MS", verdana, arial,tahoma;
font-size:18pt;
padding-right:20px;
}

#form{

position:absolute;
z-index:1;
margin-top:-150px;
margin-left:-150px;
top:50%;
left:50%;
text-align:center;
font-family:"Trebuchet MS", verdana, arial,tahoma;
font-size:18pt;

}

-->
</style>

<script type="text/javascript">
var ray={
ajax:function(st)
{
	this.show('load');
	document.getElementById("form").style.display = "none";
},
show:function(el)
{
	this.getID(el).style.display='';
},
getID:function(el)
{
	return document.getElementById(el);
}
}
</script>



</head>
<body onLoad="MM_preloadImages('images/rollover_04.png','images/rollover_06.png','images/rollover_08.png','images/rollover_10.png','images/rollover_12.png','images/rollover_14.png','images/rollover_16.png')">
<!-- ImageReady Slices (index.psd) -->
<table width="811" height="601" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
<tr>
	<td colspan="2">
		<img src="images/index_01.png" width="239" height="213" alt=""></td>
	<td width="572" height="601" rowspan="15" valign="middle" background="images/index_02.png"><blockquote>
	  <div id="form">
          <table width="353" height="316" border="0">
            <tr>
              <td width="347"><form name="form1" onsubmit="return ray.ajax()" method="post" action="newcatagory.php" enctype="multipart/form-data">
                Fill Out The Form Below and Click Submit:
                <table width="341" height="156" border="0">
                <tr>
                  <td width="53">Name: </td>
                  <td width="278"><label>
                    <input type="text" name="name" id="name">
                  </label></td>
                </tr>
                <tr>
                  <td height="36">PDF File:</td>
                  <td><label>
                    <input type="file" name="file" id="file">
                  </label></td>
                </tr>
                <tr>
                  <td> </td>
                  <td><label>
                    <input type="submit" name="submit" id="submit" value="Submit">
                    </label></td>
                </tr>
              </table>
                </form>
              </td>
            </tr>
          </table>
          </div>
          <div id="load" style="display:none;"><img border="0"  src="images/ajax-loader.gif"><br>Loading, Please wait!</div>

 

 

as can be seen after clicking submit i load some text and a gif letting them know that its loading, then after its done moving the file i want to make that disapear and show the div near the top by the php code.

Link to comment
Share on other sites

I was wondering if there was anyway to make a picture and words (or just a div) appear after a query finishes running through.

 

Sorry if this is the wrong forum im not sure if this is ajax or javascript

 

Do you mean like.....instantly?

 

If you want it to appear instantly, I'd look into AJAX, otherwise it'll be a simple if statement llke was written above...requiring a refresh of the page

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.