是的!这是我的确切怀疑。
给了我一个任务Create a form using smarty functions
(fields should be First Name, Last Name, Address, Email, Gender,
Qualifications, Phone number, etc.)
我不知道他们在说什么。所以我想问一下,是否有任何函数()用于制作表单元素或任何其他可能性?我尝试在谷歌搜索但没有得到任何积极的结果。
答案 0 :(得分:1)
PHP代码
<?php
include_once "../prepengine-header.php";
$lets = $_POST['user_lang'][1];
$var = $_POST['user_lang'][0];
$var .= $lets;
$formdata = "";
if (isset($data['submit'])) {
$formdata .= $data['user_firstname']."\n" ;
$formdata .= $data['user_lastname']."\n" ;
$formdata .= $data['user_address']."\n" ;
$formdata .= $data['user_qual']."\n" ;
$formdata .= $data['user_gender']."\n" ;
$formdata .= $var."\n" ;
$formdata .= $data['user_email']."\n" ;
$formdata .= $data['user_num']."\n" ;
$formdata .= $data['user_select']."\n" ;
}
$theme->assign('data',$data);
$theme->assign('formdata',$formdata);
echo($theme->fetch('smartart/screen5-a (1).tpl'));
?>
Smarty代码
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<form class="form-horizontal" name="registration_form" id="registration_form" method="post" action="#">
<div class="form-group">
<label class="control-label col-lg-2" for="firstname">First Name: <sup style="color: #FF0000;">*</sup></label>
<div class="col-lg-10">
<input type="text" name="firstname" id="firstname" placeholder="Enter firstname" class="form-control" required="required" />
</div>
</div>
<div class="form-group row">
<label class="control-label col-lg-2" for="lastname">Last Name: <span style="color: #FF0000;">*</span></label>
<div class="col-lg-10">
<input type="text" name="lastname" id="lastname" placeholder="lastname" class="form-control" required="required" />
</div>
</div>
<div class="form-group row">
<label class="control-label col-lg-2" for="address">Address <span style="color: #FF0000;">*</span></label>
<div class="col-lg-10">
<textarea id="address" name="address" class="form-control" placeholder="Provide Address" required="required"></textarea>
</div>
</div>
<div class="form-group row">
<label class="control-label col-lg-2" for="gender">Gender <span style="color: #FF0000;">*</span></label>
<div class="col-lg-10">
<{html_radios name='gender' values=$cust_id output=$cust_gender selected=$custom_id separator='<br />'}>
</div>
</div>
<div class="form-group row">
<label class="control-label col-lg-2" for="user_lang">Languages</label>
<div class="col-lg-10">
<{html_checkboxes name='user_lang' values=$cust_ids output=$cust_names selected=$customer_id separator='<br/>'}>
</div>
</div>
<div class="form-group row">
<label class="control-label col-lg-2" for="user_country">Country</label>
<div class="col-lg-10">
<{html_options name='select' options=$myOptions class="form-control"}>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="submit" name="submit" id="submit_button" class="btn btn-default" value="Submit">
</div>
</div>
</form>
</div>
</body>
</html>