Ok here's the situation;

I have these tables setup in MySQL;

Table name - Users
UserID - INT Primary key Auto increment
Email - VARCHAR
Password - VARCHAR
Firstname - VARCHAR

Table name - WallPosts
PostID - INT Primary key Auto increment
UserID - INT Foreign key
Email - VARCHAR
Comment - VARCHAR

Here's the problem -

The user logs in

The user uses a form to place a comment into the table 'WallPosts'

The comment shows up in the table

But the users UserID and Email do not show up in the table

How do I set a php script so that the script takes the logged in users Email and UserID and places them in the 'WallPosts' table along with the 'Comment' from the form?

Thanks in advance :)

If you have variables containing these values, then you need to include some hidden input variables (<input type=hidden ...) in your form and set the values to the variables with the email and userid. Your backend update will need to include these variables in the mysql insert.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.