Inflector::humanize($key) converts Date of joining TO Date Of Joining
Posted
by Aruna
on Stack Overflow
See other posts from Stack Overflow
or by Aruna
Published on 2009-08-31T06:32:05Z
Indexed on
2010/03/18
5:01 UTC
Read the original article
Hit count: 416
cakephp
Hi,
I have a Form and i am submitting them like using
function submit($formid = null,$fillerid=null)
{
$this->data['Result']['form_id']=$formid;
$this->data['Result']['submitter_id']=$fillerid;
$this->data['Result']['submitter']=$this->Session->read('filler');
echo "submitter: ".$this->Session->read('filler');
$results=$this->Form->hasResults($this->data);
//echo http_build_query($_POST);
if(empty($results)){
foreach ($_POST as $key => $value):
if(is_array($value)){
$value = implode('', $_POST[$key]);
$this->data['Result']['value']=$value;
}
else{
$this->data['Result']['value']=$value;
}
$this->data['Result']['form_id']=$formid;
$this->data['Result']['submitter_id']=$fillerid;
$this->data['Result']['label']=Inflector::humanize($key);
$this->data['Result']['submitter']=$this->Session->read('filler');
$this->Form->submitForm($this->data);
endforeach;
$this->Session->setFlash('Your entry has been submitted.');
}
I am having A fORM LIKE
<form method="post" action="/FormBuilder/index.php/forms/submit/1/4" id="ResultSubmit">
<div class="input text"><label for="1">Firstname</label><input type="text" value="" style="width: 300px;" id="1" name="Firstname"/></div> <br/>
<div class="input text"><label for="2">Last Name</label><input type="text" value="" style="width: 300px;" id="2" name="Last Name"/></div> <br/>
<div class="input text"><label for="3">Age</label><input type="text" value="" style="width: 200px;" id="3" name="Age"/></div> <br/>
<center> <span id="errmsg3"/> </center>
<div class="input textarea"><label for="4">Address</label><textarea style="height: 300px;" id="4" rows="6" cols="30" name="Address"/></div> <br/>
<div class="input text"><label for="5">Date Of Joining</label><input type="text" value="" style="width: 300px;" id="5" name="Date of joining"/></div><br/>
<div class="input text"><label for="6">Email - Id</label><input type="text" value="" style="width: 300px;" id="6" name="Email - id"/></div> <br/>
<div class="input text">
<label for="7">Personal Number</label><input type="text" value="" maxlength="3" style="width: 30px;" id="7" name="Personal Number[]"/><input type="text" value="" style="width: 30px;" maxlength="3" id="7-1" name="Personal Number[]"/><input type="text" value="" style="width: 70px;" maxlength="4" id="7-2" name="Personal Number[]"/></div>
<span id="errmsg7"/>
<br/>
<div class="input select"><label for="8">Gender</label><select id="8" name="Gender">
MaleFemale
<div class="input text"><label for="9">Official Number</label><input type="text" value="" style="width: 200px;" id="9" name="Official Number"/></div><br/>
<div class="input select"><label for="10">Experience</label><select id="10" name="Experience">
<option value="Fresher">Fresher</option><option yrs="" 5="" value="Below">Below 5 Yrs</option><option yrs="" 10="" value="Above">Above 10 yrs</option></select></div><br/>
actually My input has the names as Firstname Last Name Age Address Date of joining Email - id Personal Number Gender Official Number
But when i use Inflector::humanize($key) for saving the names which has white space characters they have converted into like Date Of Joining i.e.., O and J becomes Capital letters... But i need to save them as such as Date of joining.. How to do so???
© Stack Overflow or respective owner