今天是專案經理指導學習PHP實戰項目的第二天下

來源:互聯網
上載者:User

標籤:exp   lod   資料庫   選項   項目   篩選   條件   min   web   

<tr>
<td width="100">品牌</td>
<td>
<?php echo SqlSelect(‘goods where 1=1‘,‘brand‘,‘select‘,‘brand‘,‘-請選擇品牌-‘); ?>
</td>
</tr>

/**********資料庫篩選菜單********************************************************/
/**
* value 為ID時顯示函數
* @param string $SqlForm 表名+條件 admin where id = ‘$id‘
* @param string $SqlId 前端要顯示的value 一般為資料庫欄位
* @param string $SqlColumn 前端頁面顯示的title
* @param string $title 預設顯示,--請選擇--
* @param string $value 預設值的ID
*/
function SqlSelect($SqlForm,$SelectName,$class,$SqlColumn,$title){
$SearchSql = mysql_query("select * from {$SqlForm}");
while($Search = mysql_fetch_array($SearchSql)){
$key = $Search[$SqlColumn];
$option[$key] = $key;
}
return select($SelectName,$class,$title,$option);
}

 


/**********option列印函數********************************************************/
/**
* 列印函數
* @param string $title 預設第一個option
* @param array $option 選項集合 array(‘男‘,‘女‘)
* @param string $value 預設使用者選中
* @return 返回結果
*/

function option($title,$option,$value){}

<tr>
<td width="100">語種</td>
<td>
<select name="oLanguage" class="select textPrice">
<?php echo option(‘-請選擇語種-‘,explode(‘,‘,website(‘language‘)),$value);?>
</select>
</td>
</tr>

/**********輸出網站自訂文字********************************************************/
function website($id){
$website = query("website"," webid = ‘$id‘ ");
return $website[‘text‘];
}

/**********拆分字串為數值**************/
explode(‘邊界符‘,‘拆分的字串‘);


/*************拆分段落************/
."".

 

/***************讀取日期返回前端頁面******************/
<td width="100">交貨日期</td>
<td>
<?php
$dArr = explode("-",$res[‘deliveryDate‘]);
echo year(‘year‘,‘select‘,‘‘,$dArr[0]).moon(‘moon‘,‘select‘,$dArr[1]).day(‘day‘,‘select‘,$dArr[2]) ;?>
</td>

/*****************網域名稱傳值接收方式*******************/
$id = $get[‘id‘];


/**************查詢單條資料執行方式*****************/
$res = query("buycar","id=‘$id‘");

 

/**
* vlaue為ID號的菜單
* @param string $SqlForm 表名+
* @param string $SelectName select 控制項名字select name=""
* @param string $class 控制項的類
* @param string $SqlId value ID <option value> </option>
* @param string $SqlColumn 前端頁面顯示的title <option value> title</option>
* @param string $title 預設顯示,--請選擇--
* @param string $value 有值的時候,預設選中該值
*/
function IDSelect($SqlForm,$SelectName,$class,$SqlId,$SqlColumn,$title,$value){
$SearchSql = mysql_query("select * from {$SqlForm}");
while($Search = mysql_fetch_array($SearchSql)){
$key = $Search[$SqlId];
$option[$key] = $Search[$SqlColumn];
}
return select($SelectName,$class,$title,$option,$value);
}


function select($name,$class,$title,$option,$value){
$result = "
<select name=‘{$name}‘ class=‘{$class}‘>
".option($title,$option,$value)."
</select>
";
//返回一個完整的下拉式功能表
return $result;
}

<!-- //管理控制項 -->
<tr>
<td width="100">品牌</td>
<td>
<?php echo IDSelect(‘goods where 1=1‘,‘brand‘,‘select‘,‘brand‘,"brand",‘-請選擇品牌-‘,$goods[‘brand‘]); ?>
</td>
</tr>

 

今天是專案經理指導學習PHP實戰項目的第二天下

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.