php e-posta göndericisi bağlantı sonra düğme tıklandığında gönderin

3 Cevap

How does one link to the submit button, I am thinking of embedding a or just using href or actually have the entire php emailer code embedded somehow inside the submit section?

Ben bir MySQL veritabanı için bir kullanıcı tarafından sağlanan bilgileri göndermek ve orada giriş yapabilirsiniz; göndermek, ya da bazı php e-posta göndericisi sadece komut olurdu ve ona bağlantı için aşağıdaki kodu kullanabilirsiniz tıkladıktan sonra kullanıcı tarafından benim veritabanında kaydedilen bilgileri kullanarak e-posta göndermek için daha şık bir yolu olup olmadığını ancak, ben sadece merak ediyorum , kullanıcı tıkladığında gönderdiğinizde, benim veritabanı üzerinde bir kopyasını ve diğer kopya kutusuna benim e-posta gönderilir, böylece?

Istendiği gibi fazla kod temin edilebilir, newb yanan için teşekkür ederim.

<label for="submit">Submit</label>
<input id="submit" type="submit" value="Send Email!" /><br />
</p>
</form>

3 Cevap

How does one link to the submit button
On a webpage, an input element with 'submit' as its 'type' attribute inside a form element will submit the form to the URL specified in the form's 'action' attribute and the response will be loaded in the window supplied in the form's 'target' attribute.

<form action='process.php' target='_blank' id='emailForm'>
    <input type='text' name='email' />
    <input type='submit' value='Send Email!' />
</form>

Yukarıdaki kod 'process.php' ve döner sayfasına yeni bir pencerede gösterilir 'email' metin alanındaki ('E-posta gönder!' Düğmesine tıkladıktan sonra) kullanıcının girdiği ne sunacaktır.

I am thinking of embedding a or just using href
If you don't want to use a submit button like the example above, the code below will produce the same results as the submit button.

<a href='javascript:document.getElementById("emailForm").submit();'>
    <img src='images/submit.jpg' />
</a>

have the entire php emailer code embedded somehow inside the submit section
Unless you're talking about AJAX, there's a clear distinction between the capability of code executed on the client side (JavaScript) and server side (PHP).

JavaScript kodu istemci tarafında yürütülen ve olası hataları kontrol (ve teslim ediliyor formu durdurma) önce bir e-posta adresi ya da giriş sayısal olması gerekiyordu harflerle bir boşluk gibi, bir form göndererek olanak tanır.

PHP kodu sunucu tarafında yürütülen ve bir veritabanında e-posta adresi (veya başka ne ihtiyaçları tasarruf) kaydeder. Ayrıca e-posta gönderme yeteneğine sahiptir. Güvenlik nedenlerinden dolayı, e-posta adresleri ve harflerle boşluk gibi, hata denetimi ve aynı kontroller için JavaScript üzerinde sadece bağımlı olmamalıdır nerede girişin sayısal olması gerekiyordu, çok PHP yapılmalıdır.

I can submit the information supplied by a user to a MySQL database and log it there; however, I was just wondering if there is a more elegant way to send email using the information saved in my database
If I understand you correctly, you now have a form that submit to a PHP file which in turn records the contents of that form (an email address) to a MySQL database which you check from time to time. Now your objective is to have the email address sent to your inbox in addition to being recorded in the MySQL database, is that right? All you need to do is to append this code to your existing PHP file that currently writes to your MySQL database.

$to = "my_address@email.com";
$subject = "New email address!";
$body = "Hi,\n\nYou have a new email address:\n" . $_REQUEST['email'];
if (mail($to, $subject, $body)) {
    echo("<p>Message successfully sent!</p>");
} else {
    echo("<p>Message delivery failed...</p>");
}

Eğer posta göndererek sorunları varsa farklı barındırma hizmeti sağlayıcıları servis sağlayıcınız ile kontrol, vb alanında bir gerektiren gibi e-posta göndererek, veya alandan Form üzerinde barındırılan etki uyan bir e-posta adresi içermesi gerekiyor düzenleyen farklı kurallar olabilir .

Değil mi ki bir action niteliğini sahip bütün mesele sizin form?

Bu şekilde kullanın:

<form method="post" action="your_page_where_you_send_a_mail"> ... </form>

Sen yapmak değil link bir button elemanı. Bir düğmeye tıklayarak (Javascript dahil ise) istemci idam ve sunucu üzerinde çoğunlukla bir eylemi tetikler. PHP ile yazılmış everthing değil istemci, sunucu üzerinde yürütülür.

Yani, evet, bir veritabanına veri kaydetmek için PHP kodu yazmak bir e-posta göndermek, bir başarı sayfasına tarayıcı yönlendirme ve ediyorum butonuna tıklayarak tetikleyen isteği işlemek için gerekli her şey.