Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Submitting Selected value into database

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
rmoloruntoba
Smarty n00b


Joined: 13 Jan 2014
Posts: 4

PostPosted: Thu Jul 31, 2014 5:26 pm    Post subject: Submitting Selected value into database Reply with quote

$isu=$_POST[''];

Looking at this code being displayed by Smarty, what will be inside $_POST[''] to be able to submit $isu into the database.

$medical_depts=&$dept_obj->getAllMedical();
/*$dept=$medical_depts->FetchRow();
$deptroom=$dept['id'];*/
$TP_SELECT_BLOCK='<select name="deptnr" size="1"><option value="">Clinics</option>';
$later_depts = $medical_depts;

while(list($x,$v)=each($medical_depts)){
$TP_SELECT_BLOCK.='
<option value="'.$v['nr'].'">';
$buffer=$v['LD_var'];
if(isset($$buffer)&&!empty($$buffer)) $TP_SELECT_BLOCK.=$$buffer;
else $TP_SELECT_BLOCK.=$v['name_formal'];
$TP_SELECT_BLOCK.='</option>';
}
$TP_SELECT_BLOCK.='</select>';

$smarty->assign('clinics',$TP_SELECT_BLOCK);
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed Aug 06, 2014 12:04 pm    Post subject: Re: Submitting Selected value into database Reply with quote

rmoloruntoba wrote:
$medical_depts=&$dept_obj->getAllMedical();

This line is bogus and should raise a runtime error.

Quote:
$TP_SELECT_BLOCK='<select name="deptnr" size="1"><option value="">Clinics</option>';
$later_depts = $medical_depts;

while(list($x,$v)=each($medical_depts)){

What is this indian code? What happened to foreach() block?
Quote:
$TP_SELECT_BLOCK.='
<option value="'.$v['nr'].'">';
$buffer=$v['LD_var'];
if(isset($$buffer)&&!empty($$buffer)) $TP_SELECT_BLOCK.=$$buffer;
else $TP_SELECT_BLOCK.=$v['name_formal'];
$TP_SELECT_BLOCK.='</option>';
}
$TP_SELECT_BLOCK.='</select>';

$smarty->assign('clinics',$TP_SELECT_BLOCK);


There's a Smarty plugin to build option lists. Use it.

Quote:
Looking at this code being displayed by Smarty, what will be inside $_POST[''] to be able to submit $isu into the database.

There will be anything the cleint will send you. And nothing, if I read your question directly.
Buy a good PHP book, learn the language and technology. Then you'll see the answer yourself.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP