I'm using Eric Martin's SimpleModal Contact Form , but I'm having a hard time passing a variable to the form
via GET.
I wanted the index.php
, I could send the variable $palestra_titulo
, and that it was used in the Form in the "Subject" field, already appearing filled and being used to send by email. >
In index.php, the GET method would be passed through an image. It would be something like <a href='data/contact.php?article_id=<?php $id ?>' class="contact"><img src="x.gif"/></a>
.
In contact.js, I have an ajax function:
$.ajax({
url: 'data/contact.php',
data: $('#contact-container form').serialize() + '&action=send&',
type: 'post',
cache: false,
dataType: 'html',
success: function (data) {
$('#contact-container .contact-loading').fadeOut(200, function () {
$('#contact-container .contact-title').html('Obrigado!');
msg.html(data).fadeIn(200);
});
},
error: contact.error
});
And in contact.php, the snippet that displays the field is:
$action = isset($_POST["action"]) ? $_POST["action"] : "";
if (empty($action)) {
// Send back the contact form HTML
$output = "<div style='display:none'>
<div class='contact-top'></div>
<div class='contact-content'>
<h1 class='contact-title'>Inscreva-se Aqui</h1>
<div class='contact-loading' style='display:none'></div>
<div class='contact-message' style='display:none'></div>
<form action='#' style='display:none'>
<label for='contact-name'>*Nome:</label>
<input type='text' id='contact-name' class='contact-input' name='name' tabindex='1001' />
<label for='contact-email'>*E-mail:</label>
<input type='text' id='contact-email' class='contact-input' name='email' tabindex='1002' />";
if ($extra["form_subject"]) {
$output .= "
<label for='contact-subject'>Palestra:</label>
<input type='text' id='contact-subject' class='contact-input' name='subject' value='' tabindex='1003' />";
}
The value that should display the value of the $ lecture_title is in the last line.
What changes in contact.js
and contact.php
should I do for this?