我想创建自定义表单页,以便使用自己的表与数据库通信。我编写了这段代码,但它没有显示在页面属性模板中。
My Template Code:
<?php
/*Tempalte Name: ICO Calendar Form */
?>
<?php get_header();?>
<?php
if($POST[\'submit\']){
global $wpdb;
$token_id=$_POST[\'token_id\'];
$coin_name=$_POST[\'coin_name\'];
if($wpdb->insert(\'ico_calendar\',
array(
\'token_id\'=>$token_name,
\'coin_name\'=>$coin_name
)
)== false) wp_die(\'Database insertion failed\');
else echo \'Database Insertion successful<p />\';
?>
<?php
}
else
{
?><form action="" method="post" id="ico">
<label> Token ID:<input type="text" name=
"token_id" size="30"/></label>
<label> Coin Name:<input type="text" name=
"coin_name" size="30"/></label>
<input type="submit" name="Submit" value="Submit"/>
</form>
<?php
}
?>