I have a page called projects.php to let the users submit their bid information via form. When the user is logged in, he can submit this form. But am not able to find out which user has applied to the job unless I specify a username field in the form itself. Each user has to write his username while submitting this form to let me know they have submitted it. I have mysql set up, where the username is stored. How to connect the username automatically when the user is submitting this form without having to enter his username when logged in.

<form id='contactus' action='<?php echo $formproc->GetSelfScript(); ?>' method='post' enctype="multipart/form-data" accept-charset='UTF-8'>

<fieldset >
<legend>Apply to work</legend>

<input type='hidden' name='submitted' id='submitted' value='1'/>
<input type='hidden' name='<?php echo $formproc->GetFormIDInputName(); ?>' value='<?php echo $formproc->GetFormIDInputValue(); ?>'/>
<input type='text'  class='spmhidip' name='<?php echo $formproc->GetSpamTrapInputName(); ?>' />

<div class='short_explanation'>* required fields</div>

<div><span class='error'><?php echo $formproc->GetErrorMessage(); ?></span></div>

<div class='updown'>
    <label for='username' >User Name*:</label><br/>
    <input type='text' name='username' id='username' value='<?php echo $fgmembersite->SafeDisplay('username') ?>' maxlength="50" /><br/>
    <span id='login_username_errorloc' class='error'></span>
</div>

<div class='container'>
    <label for='title'>Work Title*: </label><br/>
    <input type='text' name='title' id='title' value='<?php echo $formproc->SafeDisplay('title') ?>' maxlength="50" /><br/>
    <span id='contactus_title_errorloc' class='error'></span>
</div>
<div class='container'>
    <label for='bid value'>Bid value ( INR )*:</label><br/>
    <input type='number' name='bid' id='bid' value='<?php echo $formproc->SafeDisplay('bid') ?>' maxlength="50" /><br/>
    <span id='contactus_bid_errorloc' class='error'></span>
</div>
<div id="sample">
    <label for='Bidtext'>Cover letter or Bid Text*:</label><br/>
    <textarea name="Bidtext" style="width: 500px; height: 200px;" value='<?php echo $formproc->SafeDisplay('Bidtext') ?>'> </textarea>
                <span id='contactus_Bidtext_errorloc' class='error'></span>

</div>
<div class='container'>
    <label for='resume'>Upload file:</label><br/>
    <input type="file" name='resume' id='resume' /><br/>
    <span id='contactus_resume_errorloc' class='error'></span>
</div>


<div class='container'>
    <input type='submit' name='Submit' value='Submit' />
</div>

</fieldset>
</form>

After submission I get all values of the form except not knowing who filled the form.

Recommended Answers

All 3 Replies

To show who is logged in I use - Logged in as : <?= $fgmembersite->UserFullName() ?>
But I am unable to pass the value via the form when the user submits it. I know there is some php syntax which can be used to display which user submitted this form.

I would be glad to listen your voices. I am using sessions already.

Please note that it is not a registration form. I have already set up the register and login form. The above form is a form submission that a user requires to make to apply for works.

What data about the user do you have stored in the session when they're logged in?

Id?
Username?

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.