I'd like to build a good website, where the administrators can add or remove articles, etc... In the main page, I write a short part of every articles from a MYSQL database and I'd like to write in the end of every short part a simple link ("eg.: click to see more..."). And when the user click to this, he/she can see the whole of article.
When the administrator want to add a new article, he/she have to fill in a simple form. The problem, when I want to add a class or an ID to the "click to see more...", it doesn't work. And, an interesting thing, which I'd found some seconds ago: If if remove the class of , so I only write: "click to see more" (without class or ID tag), it is working. But if I add "class" or "ID" tag, it doen't work. What does it mean? :O
My code:
<?php
if (isset($_POST["submit"])){
include "../connect.php";
$last_id_mysql = mysql_query("
SELECT AUTO_INCREMENT
FROM INFORMATION_SCHEMA.tables
WHERE TABLE_NAME = 'articles'
");
while ($egysor = mysql_fetch_row($last_id_mysql)){
foreach ($egysor as $kulcs){
$last_id = $kulcs;
}
}
$date = $_POST["date"];
$short_cont = $_POST["short"];
$short_cont .= "...<span class='moreit'>click to see more</span>";
$title = $_POST["title"];
$main_text = $_POST["main_text"];
mysql_query("
INSERT INTO `toparti`.`articles` (
`main_text` ,
`date` ,
`roviditett` ,
`cim`
)
VALUES (
'$main_text', '$date', '$short_cont', '$title'
);
");
$errors = mysql_error();
if ($errors=="") {
print("<h1>Add!</h1>");
print("<script>window.setTimeout('window.close();',2000);</script>");
}
else {
print("Don't add. Reason: ".$errors);
}
mysql_close($kapcsolat);
}
?>
<html>
<head>
<title>Article</title>
</head>
<body>
<form name="uj_cikk_form" method="POST" action="<?php print($_SERVER['PHP_SELF']);?>">
<table>
<tr>
<td>A cikk címe</td>
<td><input name="title" type="text" required></td>
</tr>
<tr>
<td>Létrehozás dátuma (pl.: 2013-04-12)</td>
<td><input name="date" type="text" required></td>
</tr>
<tr>
<td>Rövidített tartalom</td>
<td><textarea cols=100 rows=5 name="short_cont" required></textarea></td>
</tr>
<tr>
<td colspan=2>
Cikk tartalma:
</td>
</tr>
<tr>
<td colspan=2>
<textarea cols=140 rows=20 name="main_text" required></textarea>
</td>
</tr>
<tr>
<td colspan=2>
<input type="submit" name="submit" value="Létrehoz!">
</td>
</tr>
</table>
</body>
</html>