After the insertion, the code is submitted in the database i want to show user that he has been success in inserting the values.After that it should redirect to the page.
For redirection i used
header("location:header.php");
I want the remaining thing to be done.I have shown a alert message using window.alert. I want other than this.
Use substr()
function to truncate the string
This is a function I've used for a similar situation. Specify a number of characters to trim it down to. If it's shorter than that number it does nothing, but if it's longer, it'll substr
it and pop the last bit off, replacing it with a ...
function desc_trim($input, $cut = 65)
{
if (strlen($input) > $cut)
{
$input = substr($input, 0, $cut);
$input = explode(" ", $input);
array_pop($input);
$input = implode(" ", $input);
$input .= "...";
}
return $input;
}