【问题标题】:Large String while during POST ignores the letters after spacePOST 期间的大字符串忽略空格后的字母
【发布时间】:2023-03-17 21:39:01
【问题描述】:

我有一个 textarea,当我在 textarea 中发布该内容时,在给出空格之前,我只得到第一个单词。例如,如果我在 textarea 中的值是“他是疯子”,我只会得到“他”。

请帮我解决这个问题;

代码:

<form name="SendSMS" method="post" action="admin_main.php">
                <div class="reg_item">Category </div>
                <div class="reg_item">
                    <select name="cat" class="reg_combo" class="tboxstyle">
                        <option value="car" class="tboxstyle">Carrer</option>
                        <option value="tho" class="tboxstyle">Thoughts</option>
                        <option value="jok" class="tboxstyle">Jokes</option>
                        <option value="hea" class="tboxstyle">Health</option>
                     </select>
                </div><br />


                <div class="reg_item">Message </div>
                <div class="reg_item"><input type="text" name="message" class="tboxstyle"></input></div><br />



                 <?
                            if ( $_SERVER['REQUEST_METHOD'] == 'POST' )
                            {

                            $msms=new sms();
                            $msms->sendsms();


                            }

                         ?>


                <div class="reg_item"><input type="submit" name="register" value="Send >>" /></div>
                </form>

功能:

function sendsms()
        {   
        try
            {

                                $cat              =$_POST[cat];
                $message      =$_POST[message];
                                $link="http://www.aswinanand.com/sendsms.php?uid=9488446874&pwd=sivad&phone=9952880550&msg=dg";
                $table="";

                if($cat=="car")
                {
                    $table=="carrer_memb";
                }
                elseif($cat=="tho")
                {
                    $table=="thoughts_memb";
                }
                elseif($cat=="jok")
                {
                    $table=="jokes_memb";
                }
                elseif($cat=="hea")
                {
                    $table=="health_memb";
                }



                $result = mysql_query("SELECT mobile FROM carrer_memb");

                                while($row = mysql_fetch_array($result))
                                {
                                     echo $message;
                                   $link="http://www.aswinanand.com/sendsms.php?uid=9488486874&pwd=sivakasi&phone=".$row['mobile']."&msg=".$message;
                                   $contents = file_get_contents($link);
                                   echo $contents;
                                   //header("Location: http://www.aswinanand.com/sendsms.php?uid=9488486874&pwd=sivakasi&phone=".$row['mobile']."&msg=".$message);


                                }



            }
        catch(Exception $e)
            {
                echo 'Caught exception: ',  $e->getMessage(), "\n";
            }
        }








}

【问题讨论】:

  • 我们可以看看你的代码吗? PHP 还是 .NET 还是 (PHP.NET)?

标签: .net php html css


【解决方案1】:

您必须将urlencode 函数应用于链接字符串中的所有值:

$params = array(
    'uid'  =>urlencode($uid),
    'pwd'  =>urlencode($pwd),
    'phone'=>urlencode($row['mobile']),
    'msg'  =>urlencode($message)
);
$link= 'http://www.aswinanand.com/sendsms.php?' . http_build_query($params)

附: 更改您的密码,切勿在线发布您的用户名和密码

【讨论】:

  • 你输入我的答案比我快。 :)
【解决方案2】:

您的浏览器有 99.99% 的可能正确发布整个内容(请使用诸如 FirebugLiveHTTPHeaders 之类的 Firefox 扩展程序来确定)。几乎可以肯定,问题出在解析 HTTP 请求的服务器端代码中。您是否有机会发布该内容并进一步解释一下您的环境?

【讨论】:

    猜你喜欢
    • 2020-05-23
    • 2021-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-14
    • 1970-01-01
    • 2015-02-18
    • 1970-01-01
    相关资源
    最近更新 更多