Jump to content

Recommended Posts

Ok i have a form to submit News. so the title, username, date and body.

 

but like always i check the table for the data enter to make sure its right but when the form submits it just out in the $username variable.

 

so i'm guessing here when i look at the news which ever user i'm logged in as will be displayed.

 

how do i make the form enter the username string of the user from the username variable to if you are logged in as admin and you post something it shows in the database that admin posted it.

 

heres my form

 

<form method="post">
<input type="hidden" name="username" value="$username">
<table width="50%">
<tr><td>Title <input type="text" class="textfield" name="title"></td></tr>
<tr><td>Date <input type="text" class="textfield" name="date" /> </td></tr>
<tr><td></td></tr>
<tr><td>Body <textarea cols="40" rows="10" class="textbox" name="body"></textarea></td></tr>

<tr><td><input type="submit" name="submit" value="Post News"></td></tr>
</table>

</form>

Link to comment
https://forums.phpfreaks.com/topic/160830-solved-username-post/
Share on other sites

how do i make the form enter the username string of the user from the username variable to if you are logged in as admin and you post something it shows in the database that admin posted it.

 

I guess I'm confused here.  Check the database to see what group the '$username' is in?

Link to comment
https://forums.phpfreaks.com/topic/160830-solved-username-post/#findComment-848823
Share on other sites

ok heres what i want it to do.

 

if im logged in as admin lets say

 

and i post some news.

 

when a guest comes to the site and users logged in i want it to say admin not the users username.

 

so how do i get the form to submit the value of $username

Link to comment
https://forums.phpfreaks.com/topic/160830-solved-username-post/#findComment-848825
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.