CodeIgniter Forums
Newbie: upload helper tutorial / adding more fields - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Newbie: upload helper tutorial / adding more fields (/showthread.php?tid=4672)



Newbie: upload helper tutorial / adding more fields - El Forum - 12-09-2007

[eluser]loopymonkey[/eluser]
http://ellislab.com/codeigniter/user-guide/libraries/file_uploading.html

I'm able to follow along and create a page that submits a file which is fantastic, but very simply how can i, using the same code as a base, add a text input field called username and then on the form success page show the data collected with that username at top?


Newbie: upload helper tutorial / adding more fields - El Forum - 12-09-2007

[eluser]ejangi[/eluser]
As per the user-guide, in the Controller method that "catches" the request (i.e. where you're dealing with your file-upload stuff and displaying a view after the submit) you can do this:
Code:
function upload()
{
    $data['username'] = $this->input->post('username');
    $this->load->view('success', $data);
}

and in the view (success.php):
Code:
<p>Hello &lt;?php echo $username; ?&gt;</p>
<p>You have successfully uploaded a file!</p>



Newbie: upload helper tutorial / adding more fields - El Forum - 12-09-2007

[eluser]loopymonkey[/eluser]
thanks, that worked! I'm still trying to wrap my head around the php difference with ci. I need to page through that userguide.