小编Ban*_*ros的帖子

在表单提交w /验证后提供下载服务

我在.php中创建了一个非常简单的下载代码救赎者(感谢此处的帮助),并且我很难弄清楚如果验证成功,下载服务的最佳方式是什么.基本上 -

用户输入无效代码 - >页面刷新并显示错误消息.用户输入有效代码 - >下载"另存为" - >刷新页面.

在我使用http://www.zubrag.com/scripts/download.php来提供文件的那一刻,但是一旦开始下载,我的表单刷新页面,但只有一半加载内容?!

这是我用PHP脚本的表单.

<div class="dcrForm">
    <p>Have a physical copy of this release? Claim your digital download by entering your Download Code below.</p>
    <form  action="index.php" method="post">
        <input type="text" name="code" class="dcrInput" value="">
        <input type="submit" name="harrisSubmit" class="dcrSubmit" value="Submit">
    </form>
<?php
    include("scripts/dcr_config.php");
    $code="";
    $log="";

    if (isset($_POST['harrisSubmit']))
    {
        $code=$_POST['code'];

        $link = mysql_connect($hostname, $dbusername, $dbpassword);
        mysql_select_db("$databasename");

        $query = "select count from $harris where code='$code'";
        if ($q=mysql_query($query))
            if ($r=mysql_fetch_array($q)){
                if ($r[0]<3)
                {
                    $subquery="update $tbname set count='".($r[0]+1)."' where …
Run Code Online (Sandbox Code Playgroud)

php download http-headers page-refresh

5
推荐指数
1
解决办法
4968
查看次数

Chrome中的Textarea宽度未正确应用

在页脚中的联系人框中,textarea和输入框的宽度为310px.

http://www.bantros.net

它们被设置为308px宽,1px边框.在IE9,Firefox和Opera中,一切都是相同的宽度,但在Chrome(我的默认浏览器)中,textarea会溢出,除非宽度设置为304px.

使用Inspect Element我可以将它报告为314px宽,但我不太清楚为什么要这样做.任何信息或帮助将不胜感激,谢谢

textarea google-chrome width

4
推荐指数
1
解决办法
3910
查看次数

在Shopify中通过Javascript添加20%的产品价格

可能有一个简单的答案,有人可以帮助我,但我用Javascript不是那么好.基本上在Shopify中,我设置的价格是用他们的一个液体标签显示+ 20%.除了产品页面之外,这样做很有效,因为如果大小缺货并且价格也变得缺货,有一些Javascript会禁用添加到购物车按钮.无论如何这里是代码:

<script>
    var selectCallback = function(variant, selector) {
      if (variant && variant.available) {
        // valid variant selected
        $('#add-to-cart').removeClass('disabled').removeAttr('disabled').val('Add to Cart'); // remove unavailable class from add-to-cart button, and re-enable button
        if (variant.compare_at_price == 0){
          $('.product-title .price').html(''+Shopify.formatMoney(variant.price, "{{shop.money_format}}")+' Excluding VAT');
        } else {
          $('.product-title .price').html('<span>'+Shopify.formatMoney(variant.price, "{{shop.money_format}}") + '</span> <del>' + Shopify.formatMoney(variant.compare_at_price, "{{shop.money_format}}") + ' Excluding VAT</del>');
        }
      } else {
        // variant doesn't exist
        $('#add-to-cart').addClass('disabled').attr('disabled', 'disabled').val('Sold Out'); // set add-to-cart button to unavailable class and disable button
        var message = …
Run Code Online (Sandbox Code Playgroud)

javascript shopify

2
推荐指数
1
解决办法
2759
查看次数

反应多个复选框过滤器

昨天开始学习React以获得乐趣,我正在尝试制作一个简单的活动列表Web应用程序.我发现官方文档非常好,并且一直在关注他们的例子.

所以我根据自己的需要对他们的"反思中的思考" - [ http://facebook.github.io/react/docs/thinking-in-react.html]教程进行了剔除,但遇到了一个我无法包装的问题到处走走.

我想有多个复选框过滤器来更新数据表但我无法掌握如何控制这些单独输入的状态,同时管理必要的道具.我想我理解为什么所有复选框都被选中,只有一个被选中,因为他们从父isChecked道具中获取状态?

var EventFilter = React.createClass({

  handleChange: function() {

    if (this.refs.isCheckedInput.checked) {

      this.props.onUserInput(
        this.refs.isCheckedInput.value,
        this.refs.isCheckedInput.checked
      );

    } else {
      this.props.onUserInput('', false);
    }

  },

  render: function() {

    return (
      <label>
        <input
          type="checkbox"
          value={this.props.value}
          checked={this.props.isChecked}
          ref="isCheckedInput"
          onChange={this.handleChange}
        />
        {this.props.value}
      </label>
    );

  }

});


var App = React.createClass({

  getInitialState: function() {

    return {
      selectedFilter: '',
      isChecked: false
    };

  },

  handleUserInput: function(selectedFilter, isChecked) {

    this.setState({
      selectedFilter: selectedFilter,
      isChecked: isChecked
    });

  },

  render: function() {

    return (

      <div className="app">

        <div> …
Run Code Online (Sandbox Code Playgroud)

javascript checkbox reactjs

2
推荐指数
1
解决办法
5083
查看次数