Hallo,

Ik heb een weblog moeten maken voor school dat is gelukt.
Alleen het probleem als ik iets post, wil ik het id zien van de persoon die zich ingelogd heeft.

Reactie script waar je het kan invoeren:



<HTML>

<HEAD>

<TITLE>Add a Weblog Entry</TITLE>

</HEAD>

<body background="images/background.jpg">

<style>
body
{
color: white;
font-family:arial;
font-size:11px;
text-align:center;
}

TABLE, TH, TD, TR {border: 1px inset grey;}

A:link {font-size:11; font-weight:bold; color: white; text-decoration: none}
A:visited {font-size:11; font-weight:bold; color: white; text-decoration: none}
A:active {font-size:11; font-weight:bold; color: white; text-decoration: none}
A:hover {font-size:11; font-weight:bold; color: white; text-decoration: none}

</style>


<H1>Add an Entry</H1>

<form method="POST" action="addentry.php">



<b>Titel:</b><br>

<input type="text" name="entrytitle"><br>

<b>Reactie:</b><br>

<textarea cols="60" rows="6" name="entrytext"></textarea>

<br> <input type="submit" name="submit" value="Submit">

</form>

</BODY>

</HTML>

-----------------------------------------------------------------

Addentry.php is die het doorstuurt naar de db.

<BR><BR><style>
body
{
color: white;
font-family:arial;
font-size:11px;
text-align:center;
background-image:url('images/background.jpg');
}

A:link {font-size:11; font-weight:bold; color: blue; text-decoration: none}
A:visited {font-size:11; font-weight:bold; color: blue; text-decoration: none}
A:active {font-size:11; font-weight:bold; color: blue; text-decoration: none}
A:hover {font-size:11; font-weight:bold; color: blue; text-decoration: none}

</style>

<?php



if ($HTTP_POST_VARS['submit']) { mysql_connect("localhost","jordi","server"); mysql_select_db("weblog");


$entryauthor=$HTTP_POST_VARS['entryauthor'];
$entrytitle=$HTTP_POST_VARS['entrytitle'];
$entrytext=$HTTP_POST_VARS['entrytext'];
$query ="INSERT INTO weblog (entryauthor,entrytitle,entrytext)";
$query.=" VALUES ('$entryauthor','$entrytitle','$entrytext')";

// $query="SELECT entryauthor FROM members WHERE inlognaam = ”.$row['entryauthor']


$result=mysql_query($query);


if ($result) echo "<b>Successfully Posted!<br><br><br></b>";

else echo "<b>ERROR: unable to post.<br><br><br></b>";

echo '<a href="javascript:javascript:history.go(-2)">Terug om nog iets te posten!</a><br><br>';
echo '<a href="index.php">Terug naar hoofdpagina</a>';

} ?>

------------------------------------------------

Dus nu moet ik eigenlijks als ik iets toevoeg, de auteur krijg te zien op de index pagina, dus hier moet hij ergens automatisch worden toegevoegd.

Groet Jordi.
Nee, HEEL php te leren gaat inderdaad te ver, en er is niemand die HEEL PHP kent. De basis valt best mee... paar daagjes als je even goed doorwerkt?

Reageren