Adaugare date in formular fara sa poata fi modificate
Scris: Mie Dec 28, 2011
Buna deci am o mare problema ce nu o inteleg :
deci trebuie sa se adauge cateva date suplimentare de la
Script Ce trimite date
si nu stiu cu sa pun sa apara in postare datele de unde scrie Aici adauga textul tau + Adaugat de <?php echo $_SESSION['username'];?> (numele utilizatorului ce adauga) , In Data <?=$data?>(se ia de la variabila $data de mai sus) dar fara sa apara in formularul textarea
script trimite date in baza de date ...
deci trebuie sa se adauge cateva date suplimentare de la
Script Ce trimite date
Cod: Selectaţi tot
Titlu : <input type="text" maxlength="25" name="post_title"/>Max 25 Caractere</font><br><br>
descriere : <br><br><input type="button" onclick="setClass('');" value="Normal" />
<input type="button" onclick="setClass('italics');" value="Inclinat" />
<input type="button" onclick="setClass('bolded');" value="Ingrosat" /><br>
<textarea type="text" id="txt" cols="40" rows="6" name="post_content" />
Aici adauga textul tau
//-- aici e problema ca nu vreau sa apara datele astea in textare ca le poate sterge ...
Adaugat de <?php echo $_SESSION['username'];?> , In Data <?=$data?>
</textarea><br>
<!--adauga data->
<?php
$data = date("Y-m-d G:i:s");
?>
Acord : <input type="checkbox" value="post" name="post_type" CHECKED/>Termeni Si Conditii<br>
<br>Verificare Anti Spam : <br><img src="http://www.phpjabbers.com/captcha.php">
<br>Introdu codul Anti Spam<br><input type="text" name="post_name"/><br>
<INPUT TYPE=RADIO NAME="post_date" VALUE="<?=$data?>" CHECKED >
<INPUT TYPE=RADIO NAME="post_date_gmt" VALUE="<?=$data?>" CHECKED >
<INPUT TYPE=RADIO NAME="post_modified" VALUE="<?=$data?>" CHECKED >
<br><input type="submit" value="Trimite Bancul" /><br>
script trimite date in baza de date ...
Cod: Selectaţi tot
<?php
$con = mysql_connect("localhost","username","pass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("baza de date", $con);
$sql="INSERT INTO skalumea_posts (post_date_gmt, post_date, post_author, post_title, post_content, post_type, post_name)
VALUES
('$_POST[post_date_gmt]','$_POST[post_date]','$_POST[post_author]','$_POST[post_title]','$_POST[post_content]','$_POST[post_type]','$_POST[post_name]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "A fost adaugt ...";
mysql_close($con)
?>