HTML 联系表格7订购表格

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HTML 联系表格7订购表格相关的知识,希望对你有一定的参考价值。

Contact Form 7 Ordering Form:

<style type="text/css">
<!--
form {  /* set width in form, not fieldset (still takes up more room w/ fieldset width */
  font:100% verdana,arial,sans-serif;
  margin: 0;
  padding: 0;
  min-width: 500px;
  max-width: 600px;
  width: 560px; 
}

form fieldset {
	border: 1px dotted orange;
	padding: 12px;        /* padding in fieldset support spotty in IE */
	margin: 0;
}

form fieldset legend {
	font-size:1.1em; /* bump up legend font size, not too large or it'll overwrite border on left */
                       /* be careful with padding, it'll shift the nice offset on top of border  */
	font-weight: bold;
	color: #4F719C;
}

form label { 
	display: block;  /* block float the labels to left column, set a width */
	float: left; 
	width: 150px; 
	padding: 0; 
	margin: 5px 0 0; /* set top margin same as form input - textarea etc. elements */
	text-align: right; 
}

form fieldset label:first-letter { /* use first-letter pseudo-class to underline accesskey, note that */
	text-decoration:underline;    /* Firefox 1.07 WIN and Explorer 5.2 Mac don't support first-letter */
                                    /* pseudo-class on legend elements, but do support it on label elements */
                                    /* we instead underline first letter on each label element and accesskey */
                                    /* each input. doing only legends would  lessens cognitive load */
                                   /* opera breaks after first letter underlined legends but not labels */
}

form input, form textarea {
	/* display: inline; inline display must not be set or will hide submit buttons in IE 5x mac */
	width:auto;      /* set width of form elements to auto-size, otherwise watch for wrap on resize */
	margin:5px 0 0 10px; /* set margin on left of form elements rather than right of
                              label aligns textarea better in IE */
}

form input#reset {
	margin-left:0px; /* set margin-left back to zero on reset button (set above) */
}

textarea { overflow: auto; }

form small {
	display: block;
	margin: 0 0 5px 80px; /* instructions/comments left margin set to align w/ right column inputs */
	padding: 1px 3px;
	font-size: 88%;
	text-align: left;
}
form tagline {
	display: block;
	margin: 0 0 5px 160px; /* instructions/comments left margin set to align w/ right column inputs */
	padding: 1px 3px;
	font-size: 88%;
	text-align: left;
}

form .required{font-weight:bold;} /* uses class instead of div, more efficient */

form br {
	clear:left; /* setting clear on inputs didn't work consistently, so brs added for degrade */
}

-->
</style>
<script type="text/javascript">
<!--
    function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }
//-->
</script>
<p><span style="color: red; font-weight:bold;">*</span>= required.</p>

<fieldset>
<legend>Personal Information</legend>
<label for="firstname">First name: </label>[text* first]  <span style="color: red; font-weight:bold;">*</span>
<label for="lastname">Last name: </label>[text* last] <span style="color: red; font-weight:bold;">*</span><br />
<label for="email">Email: </label> [email* order-email] <span style="color: red; font-weight:bold;">*</span><br />
<label for="phone">Phone: </label> [text* your-phone id:phone] <span style="color: red; font-weight:bold;">*</span>
</fieldset>

<fieldset>
<legend>Item/s</legend>
<label for="item1-description">Item 1 Description: </label> [textarea* item1-description id:item1-description] <span style="color: red; font-weight:bold;">*</span>
<a href="#item2" onclick="toggle_visibility('item2');">Add Item +</a>
<div style="display:none;" id="item1">This is Item 1<p>
</div>
<a name="item2"> </a>
<div id="item2" style="display: none;">
<label for="description">Item 2 Description: </label> [textarea item2-description id:item2-description]
<a href="#item3" onclick="toggle_visibility('item3');">Add Item +</a>
</div>

<a name="item3"> </a>
<div id="item3" style="display: none;">
<label for="description">Item 3 Description: </label> [textarea item3-description id:item2-description]
<a href="#item3" onclick="toggle_visibility('item4');">Add Item +</a>
</div>

<a name="item4"> </a>
<div id="item4" style="display: none;">
<label for="description">Item 4 Description: </label> [textarea item4-description id:item4-description]<span style="color: red; font-weight:bold;">*</span>
</div>

</fieldset>

<fieldset>
<legend>Delivery</legend>
<label  for="delivery">Delivery Options</label> [checkbox* checkbox-delivery-991  id:delivery exclusive "Next Day" "3-4 Days" "7-10 Days"] <span style="color: red; font-weight:bold;">*</span>
</fieldset>

<fieldset>
<legend>Payment</legend>
<label>Credit Card:</label> [radio radio-ordering-951 "Visa" "MasterCard" "Amex"]<br />
<label>Card Number:</label> [text* text-cc-647 40/] <span style="color: red; font-weight:bold;">*</span>
<label>Expiration</label>
<label>Month:</label> [text* cc-expiration-month 2/2]   Year:[text* cc-expiration-year id: cc-expiration-year 4/4] xx/xxxx format
<label>CVV:</label> [text* cvv 3/3] <span style="color: red; font-weight:bold;">*</span> <span style="font-size: 88%;">(three digit code from back of your card)</span>
</fieldset>

<fieldset>
<legend>Billing Address</legend>
<label>Billing Name:</label> [text billing-name]
<tagline>(if different from above - as it appears on your credit card)</tagline>
<label>Billing Address:</label> [text* billing-street1] <span style="color: red; font-weight:bold;">*</span>
<label>Billing Address 2:</label> [text billing-street2]
<label>City:</label> [text* billing-city]  <span style="color: red; font-weight:bold;">*</span>
<label>State:</label> [text* billing-state 2/2]  Zip:[text* billing-zip 8/8]  <span style="color: red; font-weight:bold;">*</span>
<label>Country</label>[select menu-order-country "USA" "Canada"]
</fieldset>

<fieldset>
<legend>Shipping Address</legend>
<tagline>(if different from above)</tagline>
<label>First:</label> [text shipping-first]
<label>Last:</label>  [text shipping-last]
<label>Address:</label> [text shipping-street1]
<label>Address 2:</label> [text shipping-street2]
<label>City:</label> [text shipping-city]
<label>State:</label> [text shipping-state 2/2] Zip:[text shipping-zip 8/8]
</fieldset>

<fieldset>
<legend>Captcha</legend>
[captchac captcha-80]
<label>Enter the letters from above:</label> [captchar captcha-80] <!--  requires really simple captcha plugin -->
<tagline>(not cAse sEnsiTivE)</tagline>
</fieldset>

<fieldset>
<legend>Place Order</legend>
[submit "Order Now"]
</fieldset>

将字符串列表转换为表格

【中文标题】将字符串列表转换为表格【英文标题】:Convert list of strings to table 【发布时间】:2018-07-04 15:31:30 【问题描述】:

我只是一个sql初学者,想把字符串转成表格

申请日期:01/02/2018 请求:购买书籍 联系方式:电子邮件:hi@gmail.com 电话:0123456789 订购查询:订单 ID:12345678 BL:87654321 产品:123456 书籍

申请日期:01/04/2018 请求:Retour table 联系人:Rodion Raskólnikov 电子邮件:hello@outlook.com 电话:9876543210 订购查询:订单 ID:87654321 BL:12345678 产品:654321 Tables

像这样:

我试过这个:

WITH raw_messages AS (SELECT lines
  FROM `my_table` 
  WHERE REGEXP_CONTAINS(lines, '^Date of application: '))

SELECT 
  REGEXP_EXTRACT(lines, r'^Date of application: [0-9]2/[0-9]2/[0-9]4') as date

FROM raw_messages

它没有按我的意愿工作,我不知道如何继续构建我的表。

【问题讨论】:

【参考方案1】:

如果您的字符串中的字段顺序未知/保证,但您知道其中的所有字段 - 下面足够聪明,可以正确解析这些字段

#standardSQL
WITH raw_messages AS (
  SELECT lines FROM `project.dataset.my_table` 
  WHERE REGEXP_CONTAINS(lines, '^Date of application: ')
), fields AS (
  SELECT 'Date of application' field, 'date' column UNION ALL
  SELECT 'Request', 'request' UNION ALL
  SELECT 'Contact', 'contact' UNION ALL
  SELECT 'email', 'email' UNION ALL
  SELECT 'Tel', 'phone' UNION ALL
  SELECT 'Order ID', 'id' UNION ALL
  SELECT 'BL', 'bl' UNION ALL
  SELECT 'Product', 'product' UNION ALL
  SELECT 'Ordered inquiry', '' UNION ALL
  SELECT 'Boundary of string', ''
), patterns AS ( 
  SELECT f1.field, f1. column, CONCAT(r'(?i) ',f1.field,': (.*)',f2.field,': ') pattern
  FROM fields f1 CROSS JOIN fields f2
), splits AS (SELECT ARRAY(
      SELECT AS STRUCT column, ARRAY_AGG(value ORDER BY LENGTH(value) LIMIT 1)[OFFSET(0)] value
      FROM (SELECT column, REGEXP_EXTRACT(CONCAT(' Boundary of string: ', lines, ' Boundary of string: '), pattern) value
        FROM patterns ) 
      WHERE NOT value IS NULL AND NOT column = '' GROUP BY column 
    ) arr FROM raw_messages
) SELECT 
  (SELECT value FROM UNNEST(arr) WHERE column='date')     AS DATE,
  (SELECT value FROM UNNEST(arr) WHERE column='request')  AS request,
  (SELECT value FROM UNNEST(arr) WHERE column='contact')  AS contact,
  (SELECT value FROM UNNEST(arr) WHERE column='email')    AS email,
  (SELECT value FROM UNNEST(arr) WHERE column='phone')    AS phone,
  (SELECT value FROM UNNEST(arr) WHERE column='id')       AS id,
  (SELECT value FROM UNNEST(arr) WHERE column='bl')       AS bl,
  (SELECT value FROM UNNEST(arr) WHERE column='product')  AS product
FROM splits     

您可以使用与我的另一个答案相同的虚拟数据进行上述测试,显然结果应该是相同的

注意:如您所见 - 您需要明确设置 fields AS (...) CTE,字符串中的所有字段和相应的列名以任何顺序使用但很重要 - 您需要在此处再添加一个条目 - 'Boundary of string'

【讨论】:

【参考方案2】:

以下是 BigQuery 标准 SQL

假设您的行中字段的顺序设置为您的示例中的设置

#standardSQL
WITH raw_messages AS (
  SELECT lines
  FROM `my_table` 
  WHERE REGEXP_CONTAINS(lines, '^Date of application: ')
)
SELECT 
  REGEXP_EXTRACT(lines, r'(?i)^Date of application: ([0-9]2/[0-9]2/[0-9]4)') AS DATE,
  REGEXP_EXTRACT(lines, r'(?i) Request: (.*?) Contact: ') AS request,
  REGEXP_EXTRACT(lines, r'(?i) Contact: (.*?) email: ') AS contact,
  REGEXP_EXTRACT(lines, r'(?i) email: (.*?) Tel: ') AS email,
  REGEXP_EXTRACT(lines, r'(?i) Tel: (.*?) Ordered inquiry: ') AS phone,
  REGEXP_EXTRACT(lines, r'(?i) Order ID: (.*?) BL: ') AS id,
  REGEXP_EXTRACT(lines, r'(?i) BL: (.*?) Product: ') AS bl,
  REGEXP_EXTRACT(lines, r'(?i) Product: (.*?)$') AS product
FROM raw_messages   

您可以使用您问题中的虚拟数据进行测试,如下所示

#standardSQL
WITH `project.dataset.my_table` AS (
  SELECT 'Date of application: 01/02/2018 Request: Buy books Contact: email: hi@gmail.com Tel: 0123456789 Ordered inquiry: Order ID: 12345678 BL: 87654321 Product: 123456 Books' lines UNION ALL
  SELECT 'Date of application: 01/04/2018 Request: Retour table Contact: Rodion Raskólnikov email: hello@outlook.com Tel: 9876543210 Ordered inquiry: Order Id: 87654321 BL: 12345678 Product: 654321 Tables'
), raw_messages AS (
  SELECT lines
  FROM `project.dataset.my_table` 
  WHERE REGEXP_CONTAINS(lines, '^Date of application: ')
)
SELECT 
  REGEXP_EXTRACT(lines, r'(?i)^Date of application: ([0-9]2/[0-9]2/[0-9]4)') AS DATE,
  REGEXP_EXTRACT(lines, r'(?i) Request: (.*?) Contact: ') AS request,
  REGEXP_EXTRACT(lines, r'(?i) Contact: (.*?) email: ') AS contact,
  REGEXP_EXTRACT(lines, r'(?i) email: (.*?) Tel: ') AS email,
  REGEXP_EXTRACT(lines, r'(?i) Tel: (.*?) Ordered inquiry: ') AS phone,
  REGEXP_EXTRACT(lines, r'(?i) Order ID: (.*?) BL: ') AS id,
  REGEXP_EXTRACT(lines, r'(?i) BL: (.*?) Product: ') AS bl,
  REGEXP_EXTRACT(lines, r'(?i) Product: (.*?)$') AS product
FROM raw_messages    

结果

Row DATE        request         contact             email               phone       id          bl          product  
1   01/02/2018  Buy books       null                hi@gmail.com        0123456789  12345678    87654321    123456 Books     
2   01/04/2018  Retour table    Rodion Raskólnikov  hello@outlook.com   9876543210  87654321    12345678    654321 Tables    

【讨论】:

以上是关于HTML 联系表格7订购表格的主要内容,如果未能解决你的问题,请参考以下文章

如何使用联系表格 7 在邮件正文中发送 HTML 内容?

提交时将 HTML 添加到联系表格 7 电子邮件

html 联系表格7

联系表格 7 添加特殊 ID

Wordpress - 联系表格 7 - 卡住发送联系表格

Wordpress 中联系表格 7 的日期和时间