Yvonne
Yvonne

Reputation: 155

Enter ID instead of name on submit (form)

In my users_subjects table, I have a user ID and a subject ID. When a user (of admin level) creates a subject they select from a drop down menu a project. Here is the select query to draw up appropriate values:

$sql = "SELECT users_subjects.users_subjectsid, subjects.subjectn FROM subjects JOIN users_subjects on subjects.subjectid = users_subjects.userid ";

And for the tag with the dropdown menu, I have this:

<?php echo $row['subjectn']?> 

I have tried submitting the form with 'subjectid' here instead and the subject ID is stored successfully in my users_subjects table. However, the user needs to see the subject names (IDs arent exactly user-friendly!)

Upvotes: 0

Views: 187

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798716

<option value="projectidgoeshere">Project name goes here</option>

Upvotes: 2

Related Questions