First of all sorry for bad English
this is my script:
profile.php
process.phpHTML Code:<div style='margin-left: 5px;' id='postppm'> <form method="post" target="iframe_1" action="process.php?m=ok"> <span style="color:rgb(20,70,250);">Personal profile message:</span> <br /> <TEXTAREA name="message" COLS=45 ROWS=5 maxlength="2000"><?php if(isset($errorstrlen)){ echo $errorstrlen; } ?></TEXTAREA> <input type='hidden' name='n' value='<?php echo $easynamep; ?>'> <input type='submit' value='ppm' class="button"> </form> <iframe src="process.php" name="iframe_1" id="iframe_1"> </iframe> </div> <div id="test"> Here is were all the message's of the user stands (I want to reload that if the user pressed on submit) <div>
So after a user presses on submit could I change content on profile.php?PHP Code:<?php
session_start();
// handle postppm
if ($_SERVER['REQUEST_METHOD']=='POST' and isset($_POST['message']) and $_GET['m']=="ok" and isset($_POST['n'])) {
if(strlen($_POST['message'])>=5){
$errorstrlen2 = $_POST['message'];
if(strlen($errorstrlen2)>2000){
$count = strlen($errorstrlen2);
echo 'Too long message <b>' . $count . '</b>, allowed (2000)';
}
else{
$easynamep = $_POST['n'];
$query = mysql_query("SELECT id FROM users WHERE easyname='" . mysql_real_escape_string( $easynamep ) . "' LIMIT 1"); // get basic of user
$row = mysql_fetch_assoc($query);
$ido = $row['id'];
$time = date("y-m-d H:i:s", time());
$time = convert_datetime($time);
$message = $_POST['message'];
$query = "
INSERT INTO usersppm
(
usersid
, ido
, message
, time
)
VALUES
(
'" . mysql_real_escape_string( $ido ) . "'
,'" . mysql_real_escape_string( $id ) . "'
,'" . mysql_real_escape_string( $message ) . "'
,'" . mysql_real_escape_string( $time ) . "'
)";
$queryupload = mysql_query($query);
echo 'Message post!';
// Here
//
// Some javascript that reload div test on profile.php
//
// Here =)
}
}
else{
$errorstrlen = $_POST['message'];
echo "5 char limit!";
}
}
?>
something like load (but that doesn't work if you execute that on process.php if it needs to affect something on profile.php) or is there a way?
Or is there an way that I have some javascript on profile.php and it gets activated if that process.php return true?
I tried this script:
but I have to copy all the php script from div test to profilemessages.php and I rather have everything on the same page. And it reloads every 10 second it only need to be reloaded if the submit of process.php is an succes. Is something like that possible?HTML Code:<script type="text/javascript"> var auto_refresh = setInterval( function () { $('#test').load('profilemessages.php').fadeIn("slow"); }, 10000); // refresh every 10000 milliseconds </script> <div id="test"> </div>
Is this possible? That I put the process.php in profile.php between something like this:
<script 'executewhenpressedsubmit'>
hole script from process.php
</script>
And if I press submit it will only execute that between <script> </script>? And it still doesn't reload the hole site? because that's what I'm trying to make an site that doesn't refresh the hole site after submit. It almost work it already gets data into the database without refreshing but now I need to refresh div test after that.
Thanks, I hope you guys understand.



Reply With Quote
Bookmarks