0

Zendeskソフトウェアの試用版をテストしており、リクエスト送信フォームをカスタマイズできるかどうか疑問に思っています。基本的に箱から出して、フォームのフィールドを変更できますが、さらにカスタマイズしたいので、独自のフォームを作成してウィジェットとして使用しようとしています。

基本的に私は非常に単純な形式を試しています:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 

<html xmlns='http://www.w3.org/1999/xhtml'>   
<head>      
    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>      
    <title>Form Page: sampleform</title>   
</head>
<body>
    <h1>Sample form page</h1> 

        <form id='sampleform' method='post' action='' >
        <p>Name: <input type='text' name='Name' /></p>    
        <p>Email: <input type='text' name='Email' /></p>
        <p><input type='submit' name='Submit' value='Submit' /></p>
    </form> 
</body>
</html>

しかし、今ではこのフォームの送信方法がわかりません。基本的に、フォームタグにメソッドとアクションが必要であることはわかっていますが、アクションとして何を使用しますか?Zendeskは当社のソフトウェアではないので、バックエンドスクリプトを使用してフォームを送信する方法はありますか?基本的にフォームはsupport@company.comに送信されるので、Zendeskのバックエンドスクリプトを使用しなくても、独自に作成してフォームリクエストをsupport@company.comに送信できますか?

これをどのように達成できるかについてのアイデアはありますか?みんなありがとう!

編集:---------2012年10月10日--------------

さて、さらに調査し、ノアが言ったことに従って、フォームデータを送信するためにこのようなPHPを作成しました。以下のように元のフォームも変更しました...

--PHPスクリプトPHPメール送信者

    if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email)) {
        echo "<h4>Invalid email address</h4>";
        echo "<a href='javascript:history.back(1);'>Back</a>";
    } elseif ($subject == "") {
        echo "<h4>No subject</h4>";
        echo "<a href='javascript:history.back(1);'>Back</a>";
    } elseif (mail($to,$subject,$description)) {
        echo "<h4>Thank you for your email</h4>";
    } else {
        echo "<h4>Can't send email to $email</h4>";
    }
?>
</body>
</html> 

--HTMLフォーム

<html xmlns='http://www.w3.org/1999/xhtml'>   
<head>      
    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>      
    <title>Form Page: Support</title>   
</head>
<body>
    <h1>Support Form Page</h1> 

    <form id='supportform' method='POST' action='supportMail.php' ></p>   
            <p>Subject: <input type='text' name='subject' /></p>    
            <p>Email: <input type='text' name='email' /></p>
            <p>Description: <input type='text' name='description' /></p>
            <p><input type='submit' name='submit' value='Submit' /></p>
    </form> 
</body>
</html>

いいえ、私はこれで完全な初心者かもしれませんが、PHPスクリプトをどこに置くべきで、フォームでどのように参照すればよいですか?のアクションセクションでそれを知っていますが、URLまたはスクリプト名だけを含める必要がありますか。

私を混乱させるのは、フォームが表示されるWebサイトとスクリプトが異なるサーバー上にあることです...スクリプトが配置されているサーバーはWindowsServerです...Windows ServerにPHPをインストールしましたが、インストールしていませんスクリプトを配置する必要がある場所を理解します。

4

1 に答える 1

0

データを送信するには、PHPファイルが必要です。

HTML

<form id='sampleform' method='post' action='file.php' > // make sure the 'action' is equal to the name of the PHP file 
        <p>Name: <input type='text' name='Name' /></p>    
        <p>Email: <input type='text' name='Email' /></p>
        <p><input type='submit' name='Submit' value='Submit' /></p>
</form> 

PHP

$name = $_POST['name']; // name that is submitted from the form
$email = $_POST['email']; // email that is submitted from the form

// mail function so yo can email information to someone with data that was submitted through the form 
mail('[enter the TO email here]','[Enter the subject here]','[enter the email message here]');
于 2012-10-04T21:06:55.580 に答える