<html> <script type=“text/javascript” src=“/lib/scripts/jquery/jquery.min.js”></script> <script type=“text/javascript”>
function tasks(task) {
$(".result").html("Processing, please wait...");
var message = $("#message").val() + "\n Articles: \n" + $("#article-list").text() + "\n E-mail: \n" + $("#replyTo").val() + "\n Address: \n" + $("#address").val();
var subject = $("#subject option:selected").text()
var recipient = 'sales@netmodule.com';
var replyTo = $("#replyTo").val();
if ($("#subject").val() == "order" ) {
recipient = 'orders@netmodule.com';
}
$.get("/lib/tpl/netmodule/tasks.php", { task: task, subject: subject, message: message, recipient: recipient, replyTo: replyTo }, function( data ) {
$( ".result" ).html("The message has been sent. We will get back to you as soon as possible.");
});
}
function update() {
$("#article-list").text("");
$( "input[name^='amount']" ).each(function( index ) {
if ( $( this ).val() ){
var id = index+1;
var article = $( "a[name='article-" + id + "']" ).html();
$("#article-list").append( $( this ).val() + " " + article + "\n<br/>" );
}
});
}
</script>
<table>
<tr>
<td>Subject:</td>
<td>
<select id='subject'>
<option value="rfi">Request for Information</option>
<option value="rfq">Request for Quotation</option>
<option value="order">Purchase Order</option>
</select>
</td>
</tr>
<tr>
<td>Articles:</td>
<td><p id='article-list'>Select articles below</p></td>
</tr>
<tr>
<td>E-mail:</td>
<td><input id='replyTo' value='@' type=text>
</td>
</tr>
<tr>
<td>Address:</td>
<td>
<textarea id='address' rows="3" cols="50">Mail address</textarea>
</td>
</tr>
<tr>
<td>Message:</td>
<td>
<textarea id='message' rows="3" cols="50">Your message goes here... </textarea>
</td>
</tr>
</table> <input value='Submit' type=Submit onclick=“tasks('mail')”> </html>
echo "<html>";
echo "<table>";
echo "<tr><th>Amount</th><th>Article / Data Sheet</th><th>Description</th></tr>";
$lines = file('data/catalog.txt');
$counter = 0;
foreach ($lines as $line) {
$counter++;
echo "<tr><td><input name='amount-$counter' type='text' size='2' onchange='update()'></td>";
$article= explode(",", $line); // catalog.txt is comma separated
$number = $article[0]; // first column
$desc = $article[1]; // second column
$fname = strtolower("$number.pdf");
echo "<td><a name='article-$counter' href='/_media/data-sheets/$fname' class='media mediafile mf_pdf' title='data-sheets:$number'>$number</a></td>";
echo "<td>$desc</td></tr>";
}
echo "</table>";
echo "</html>";