Jump to content

How to auto insert into form using value=


Tagg

Recommended Posts

Currently I am working on updating a new profile layout. On the old one you would have to put in their ID followed by the message. I know this is annoying to do for users so I wish to make it automatically insert the ID, which doesn't seem to be working for me (tried using $_GET[iD] as value= to call it).

 

    else
    {
       print "<form action='writepm.php' method='post'>";
       print "ID of recipient:<br>";
       print "<input type='text' name='nameID' size='5' value=$_GET[iD]><br>";
       print "Subject:<br>";
       print "<input name='subject' type='text' size='30'><br>";
       print "Message:<br>";
       print "<textarea name='message' rows='5' cols='40'></textarea><br><br>";
       print "<input type='submit' name='submit' value='sen

 

 

The code for 'nameID' is

       $nameID=$_POST['nameID'];
       $suser="SELECT * from km_users where ID='$nameID'";
       $suser2=mysql_query($suser) or die("Could not get user");
       $suser3=mysql_fetch_array($suser2);

 

Code used to send it once it passes the if else statements verifying if there is an ID/Subject/Msg

       {
          $subject=$_POST['subject'];
          $message=$_POST['message'];
          $date=date("U");
          $sendmessage="INSERT into km_pms (sender, receiver,subject,message,therealtime) values('$userstats3[iD]','$nameID','$subject','$message','$date')";
          mysql_query($sendmessage) or die("Could not send message");
          print "PM Sent, please go back to <A href='pm.php'>PM Main</a>.";
       }

 

I based this off the other things that can be done straight from the new profile (like view stats) which would bring up their page. But the calling of the user ID has caught me off guard which doesn't seem to work the same way I reckon?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.