|
Posted by cashmere on 10/10/84 11:50
Geoff Berrow wrote:
> 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
Thanks Geoff - I'm gettting a parse error but looking to see if it's
maybe a typo.
That was one of the many things I tried (about 5 days ago!) but
couldn't make it work.
Cheers Dave
Navigation:
[Reply to this message]
|