|
Posted by Geoff Berrow on 09/25/60 11:50
Message-ID: <1150541856.825907.232000@c74g2000cwc.googlegroups.com> from
cashmere@t-online.de contained the following:
>Thanks Geoff but the form posts the text OK, the variable $joketext
>from the form is updated just fine.
>It's the WHERE id = '$id' part that's obviously not getting passed any
>value.
>I've got the session variable containing the value that I need but
>can't get it into the statement. I've tried umpteen variations trying
>to get the value of the variable into the query.
Sorry, looking again, I was off track a bit
Why insert a row and then update it? Why not just insert it complete?
Untested...
<html><head></head><body>
<?php
$id = $_GET['id'];
if (isset($_POST['submitjoke'])){
mysql_pconnect("localhost", "root", "whatever") or die(mysql_error());
mysql_select_db("members") or die(mysql_error());
if(mysql_query("INSERT INTO `multiple` VALUES
('$_POST[id]','$_POST[joketext]'))){
echo "Joke added";
}
else{
echo "could not add joke ".mysql_error();
}
}
?>
<FORM ACTION='<?php echo($_SERVER['PHP_SELF']); ?>' METHOD='POST'>
<input type='hidden'name='id' value='<?php echo $id; ?>'>
<P>Type your joke uh message here:<BR>
<TEXTAREA NAME="joketext" ROWS=10 COLS=40 WRAP>
</TEXTAREA><BR>
<INPUT TYPE=SUBMIT NAME="submitjoke" VALUE="SUBMIT">
</FORM>
</BODY>
</HTML>
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Navigation:
[Reply to this message]
|