Why don't my date picker and time picker show up? - php

My date picker and time picker don't show up next to the "Enter date:" and "Enter time:" fields: http://heightsdental.com/RequestAppt.php. There are php include statements in the code, and when they're not there: http://evamagnus.com/RequestAppt.php, the date and time pickers are displayed.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="js/modernizr-2.5.3.min.js"></script>
<script type="text/javascript" src="js/jquery.ptTimeSelect.js"></script>
<script src="js/dimensions.js" type="text/javascript"></script>
<script src="js/jquery.ui.core.js">
</script>
<script src="js/jquery.ui.datepicker.js">
</script>
<?php
include "Banner.html";
include "header.html"
?>
<div id="form">
<div id="contain">
<form action="http://www1.budgethostingweb.com/cgi-bin/hosting/user_formmail.cgi" method="post">
<input type="hidden" name="account" value="dentist">
<input type="hidden" name="cata" value="accounts">
<input type="hidden" name="redirect" value="index.php" />
<table class="form_demo">
<tr>
<td>
<label for="name">
Name
</label>
</td>
<td>
<input class="input_full" type="text" id="name" name="name" required="required" />
</td>
</tr>
<tr>
<td><label for="email">
Email
</label>
</td>
<td>
<input class="input_full" type="email" id="email" name="email" required="required" />
</td>
</tr>
<tr>
<td>
<label for="cc">
<abbr title="Courtesy Copy">CC</abbr>
</label>
</td>
<td>
<input type="checkbox" id="cc" name="cc" value="1" />
<label for="cc">
Send me a copy of this email
</label>
</td>
</tr>
<tr>
<td>
<label for="tel">
Phone
</label>
</td>
<td>
<input class="input_full" type="tel" id="tel" name="tel" required="required" />
</td>
</tr>
<tr>
<td><label for="priority_normal">
Priority
</label>
</td>
<td>
<input type="radio" name="priority" id="priority_urgent" value="Urgent">
<label for="priority_urgent">
Urgent
</label>
<input type="radio" name="priority" id="priority_normal" value="Normal" checked="checked">
<label for="priority_normal">
Normal
</label>
</td>
</tr>
<tr>
<td>
<label for="date">Enter a date:</label>
</td>
<td>
<input class="input_xlarge" type="text" id="date" name="date" required="required" />
<script>
(function($){
var pickerOpts = {
minDate: new Date(),
maxDate: "+3m,",
showButtonPanel: true,
showOn: "button",
buttonImage: "images/cal.png",
};
$("#date").datepicker(pickerOpts);
})(jQuery);
</script>
</td></tr>
<tr><td>Enter a time: </td>
<td><input id="time1" name="s2Time1" />
<script type="text/javascript">
$('#time1').ptTimeSelect({ popupImage: 'Select Time' });
</script>
</td>
</tr>
<tr>
<td>
<label for="description">
Reason for<br />
appointment
</label>
</td>
<td>
<textarea id="description" name="description" rows="3" required="required"></textarea>
</td>
</tr>
<tr><td colspan="2">To prevent automated spam posts, <br>please type in the access code
displayed: <p><img alt="Access code"
src="http://www1.budgethostingweb.com/cgi-bin/captcha/imagegen.cgi?x-factor=1"/></p></td></tr>
<tr><td>Access Code:</td> <td><input class="medium" name="access" type="text"></td>
</tr>
</table>
<hr />
<p class="clearfix">
<input type="submit" value="Submit" class="float_left" />
<input type="reset" value="Reset" class="float_right">
</p>
</form>

File missing at below path:
http://heightsdental.com/js/jquery.ui.core.js
http://heightsdental.com/js/jquery.ui.datepicker.js

Your jQuery UI script include is failing.

A quick look into chrome's dev tools reveals:
Failed to load resource: the server responded with a status of 404 (Not Found) http://heightsdental.com/js/jquery.ui.core.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://heightsdental.com/js/jquery.ui.datepicker.js
Uncaught TypeError: Object [object Object] has no method 'datepicker' RequestAppt.php:159
Uncaught TypeError: Property '$' of object [object Window] is not a function RequestAppt.php:167
Meaning: Your JavaScript includes point to files that do not exist.
Looking into your js subdir shows: They really are not there.
(It's bad btw. to allow indexing, disable directory listing)

Related

Transform value of PHP form on submit

i'm setting up donate option on a website using przelewy24.pl. They have this startup template to send values by $_GET method to their website.
Everything works fine exept the amount field. Przelewy24 needs a gr amount (like cents) and i would like for the donor to type in integer in full zł (like $).
If the upper is not clear - when i type 100 in the field, it sends it to przelewy24 as 100 gr, whitch will be 1 zł.
I need to know how could i format the amount sent to them as in simple calculation - when 100 is typed, get sends 10000. (x*100)
The form used is shown below. The quick-start guide is avaliable here, but only in polish
<form method="get" action="https://sklep.przelewy24.pl/zakup.php">
<input type="hidden" name="z24_id_sprzedawcy" value="TWOJ_ID">
<input type="hidden" name="z24_crc" value="KLUCZ_ZAKUPU">
<input type="hidden" name="z24_return_url" value="TWOJASTRONA.PL">
<input type="hidden" name="z24_language" value="pl">
<table>
<tr>
<td align="right">Nazwa produktu:</td>
<td>
<input type="text" name="z24_nazwa" value="Opłata za rezerwację NR: 04/234/A3953">
</td>
</tr>
<tr>
<td align="right">Dodatkowy opis:</td>
<td>
<textarea name="z24_opis" style="width:250px">Dodatkowe informacje...
</textarea>
</td>
</tr>
<tr>
<td align="right">Do zapłaty:</td>
<td><input type="text" name="z24_kwota"></td><!--KWOTA W GROSZACH-->
</tr>
</table>
<input type="submit" value="zapłać z przelewy24.pl">
</form>
You can do it with a simple Javascript code.
You need to capture the value from input, transform it, and put the value on input hidden:
function formatMoney(e) {
document.getElementById('z24_kwota').value = (!isNaN(e.target.value) ? e.target.value : 0) * 100
// just to debug.. you can remove this line:
document.getElementById('final_value').innerHTML = document.getElementById('z24_kwota').value
}
<form method="get" action="https://sklep.przelewy24.pl/zakup.php">
<input type="hidden" name="z24_id_sprzedawcy" value="TWOJ_ID">
<input type="hidden" name="z24_crc" value="KLUCZ_ZAKUPU">
<input type="hidden" name="z24_return_url" value="TWOJASTRONA.PL">
<input type="hidden" name="z24_language" value="pl">
<table>
<tr>
<td align="right">Nazwa produktu:</td>
<td>
<input type="text" name="z24_nazwa" value="Opłata za rezerwację NR: 04/234/A3953">
</td>
</tr>
<tr>
<td align="right">Dodatkowy opis:</td>
<td>
<textarea name="z24_opis" style="width:250px">Dodatkowe informacje...
</textarea>
</td>
</tr>
<tr>
<td align="right">Do zapłaty:</td>
<td>
<input type="hidden" name="z24_kwota" id="z24_kwota">
<input type="text" onkeyup="formatMoney(event)"></td><!--KWOTA W GROSZACH-->
</tr>
</table>
<input type="submit" value="zapłać z przelewy24.pl">
</form>
<!-- you can remove this line: -->
Final Value: <span id="final_value"></span>
Try changing the value before submitting the form like below,
<form method="get" id="myform" action="https://sklep.przelewy24.pl/zakup.php">
<input type="hidden" name="z24_id_sprzedawcy" value="TWOJ_ID">
<input type="hidden" name="z24_crc" value="KLUCZ_ZAKUPU">
<input type="hidden" name="z24_return_url" value="TWOJASTRONA.PL">
<input type="hidden" name="z24_language" value="pl">
<table>
<tr>
<td align="right">Nazwa produktu:</td>
<td>
<input type="text" name="z24_nazwa" value="Opłata za rezerwację NR: 04/234/A3953">
</td>
</tr>
<tr>
<td align="right">Dodatkowy opis:</td>
<td>
<textarea name="z24_opis" style="width:250px">Dodatkowe informacje...
</textarea>
</td>
</tr>
<tr>
<td align="right">Do zapłaty:</td>
<td><input type="text" name="z24_kwota"></td><!--KWOTA W GROSZACH-->
</tr>
</table>
<input type="submit" value="zapłać z przelewy24.pl">
</form>
<script
src="http://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script type="text/javascript">
var firstSubmit = false;
$('#myform').on('submit',function(e){
if(!firstSubmit){
e.preventDefault();
firstSubmit = true;
var amount = parseInt($('input[name=z24_kwota]').val());
$('input[name=z24_kwota]').val(amount*100);
$('#myform').trigger('submit');
}
})
</script>
Note: I have given an id to the form as myform

How to get two forms on one submit [duplicate]

This question already has answers here:
How to submit 2 forms in one page with a single submit button
(4 answers)
Closed 7 years ago.
I have two forms that look like this:
<h2>First form</h2>
<form id="first-form">
<table>
<tr>
<td>
<input type="text" name="left[]" value="">
</td>
<td>
<input type="text" name="right[]" value="">
</td>
</tr>
<tr>
<td>
<input type="text" name="left[]" value="">
</td>
<td>
<input type="text" name="right[]" value="">
</td>
</tr>
<tr>
<td>
<input type="text" name="left[]" value="">
</td>
<td>
<input type="text" name="right[]" value="">
</td>
</tr>
<tr>
<td>
<input type="text" name="left[]" value="">
</td>
<td>
<input type="text" name="right[]" value="">
</td>
</tr>
</table>
</form>
<!-- some more HTML -->
<h2>Second form</h2>
<form id="second-form">
<label>
<input type="search" name="sentence" value="i like the bananas">
</label>
<label>
<input type="text" name="parse-as" value="S">
</label>
<label>
<select name="include-features">
<option>Yes</option>
<option selected="selected">No</option>
</select>
</label>
<label>
<select name="show-earley">
<option>Yes</option>
<option selected="selected">No</option>
</select>
</label>
<button type="submit">Parse</button>
</form>
Note that the first form can contain more rows; the user can add more rows to the form. As you can see, there's only one submit button. That's because both forms have to be submitted together. In jQuery I'd do something like this:
$("#second-form").submit(function(event) {
$("first-form").submit();
event.preventDefault();
});
As the front-end developer of the team, I need to pass down the values of both forms to the back-end. Unfortunately I'm at loss how to do this. I figured I could do something like this:
$("#second-form").on("submit", function(event) {
$("#first-form").submit();
$.post("php/do.php", $("#second-form").serialize());
event.preventDefault();
});
$("#first-form").on("submit", function(event) {
$.post("php/do.php", $("#first-form").serializeArray());
event.preventDefault();
});
.serializeArray() seems necessary because of the array-like values in the HTML for #first-form. In the second form, however, we don't need an array. The issue I'm having now is, what code do I need in do.php that can handle the input. How do you access the data, i.e. the serialized forms in PHP?
I tried a number of things such as
<?php
$data = parse_str($_POST["right[]"]);
var_dump($data);
$date1 = parse_str($_POST["right[][0]"]);
var_dump($data);
$data2 = parse_str($_POST["right[][1]"]);
var_dump($data);
?>
But all of these return an Undefined index error, which seems to mean that my "selector" is wrong. How would I go about selecting the array from the first form, and the values of the second form in PHP? And is my jQuery method of submitting first-form together with the second correct?
Why don't you do this :
<h2>First form</h2>
<form id="first-form">
<table>
<tr>
<td>
<input type="text" name="left[]" value="">
</td>
<td>
<input type="text" name="right[]" value="">
</td>
</tr>
<tr>
<td>
<input type="text" name="left[]" value="">
</td>
<td>
<input type="text" name="right[]" value="">
</td>
</tr>
<tr>
<td>
<input type="text" name="left[]" value="">
</td>
<td>
<input type="text" name="right[]" value="">
</td>
</tr>
<tr>
<td>
<input type="text" name="left[]" value="">
</td>
<td>
<input type="text" name="right[]" value="">
</td>
</tr>
</table>
<!-- some more HTML -->
<h2>Second form</h2>
<label>
<input type="search" name="sentence" value="i like the bananas">
</label>
<label>
<input type="text" name="parse-as" value="S">
</label>
<label>
<select name="include-features">
<option>Yes</option>
<option selected="selected">No</option>
</select>
</label>
<label>
<select name="show-earley">
<option>Yes</option>
<option selected="selected">No</option>
</select>
</label>
<button type="submit">Parse</button>
</form>
Maybe it's not the cleanest way to do it, but it's the easier. Just get the results with :
<?php
$data = parse_str($_POST["right[]"]);
var_dump($data);
$date1 = parse_str($_POST["right[][0]"]);
var_dump($data1);
$data2 = parse_str($_POST["right[][1]"]);
var_dump($data2);
?>

html / php code validation error

I keep getting errors while trying to validate this code.
Error message examples:
e.g. 1 - Line 152, Column 42: Unescaped '<' not allowed in attributes values …>
<input type="text" name="Name" value="<?php echo htmlspecialchars($Name); ?>"…
e.g. 2 - Line 152, Column 42: attributes construct error …>
<input type="text" name="Name" value="<?php echo htmlspecialchars($Name); ?>"…
e.g. 3 - Line 152, Column 42: Couldn't find end of Start Tag input line 152 …>
<input type="text" name="Name" value="<?php echo htmlspecialchars($Name); ?>"…
The same errors occur for any lines that contains the line e.g < php echo htmlspecialchars($...)
Please let me know what I am doing wrong.
<!-- Form-->
<form name="editcontact" method="post" action="">
<table border="1" cellpadding="2">
<caption>Edit Contact</caption>
<!--ID Input-->
<tr><td><?php if ($ContactID != '') { ?>
<input type="hidden" name="ContactID" value="<?php echo htmlspecialchars($ContactID); ?>" />
<?php } ?></td></tr>
<!--Name Input-->
<tr>
<td><label for="Name">Name</label></td>
<td><input type="text" name="Name" value="<?php echo htmlspecialchars($Name); ?>" size="30" maxlength="50" tabindex="1"/></td>
</tr>
<!-- Address Input-->
<tr>
<td><label for="Address">Address</label></td>
<td><textarea name="Address" cols="45" rows="5" tabindex="2"><?php echo htmlspecialchars($Address); ?> </textarea></td>
</tr>
<!--Phone Input-->
<tr>
<td><label for="Phone">Phone</label></td>
<td><input type="text" name="Phone" value="<?php echo htmlspecialchars($Phone); ?>" size="20" maxlength="20" tabindex="3" /> </td>
</tr>
<!--Mobile Input-->
<tr>
<td><label for="Mobile">Mobile</label></td>
<td><input type="text" name="Mobile" value="<?php echo htmlspecialchars($Mobile); ?>" size="20" maxlength="20" tabindex="4" /> </td>
</tr>
<!--Email Input-->
<tr>
<td><label for="Email">Email</label></td>
<td><input type="text" name="Email" value= "<?php echo htmlspecialchars($Email); ?>" size="30" maxlength="50" tabindex="5" /></td>
</tr>
<!--Submit Button-->
<tr>
<td colspan="2" align="center"><input type="submit" name="Submit" value="Submit" onclick="return validateForm()" tabindex="6"/>
</td>
</tr>
</table>
</form>
Run the PHP and validate the HTML output. Don't try to validate PHP as if it was HTML.

Why isn't Recaptcha showing up from PHP using XMLHttpRequest?

::EXPLINATION::
In an HTML file, I'm attempting to load a registration frame with a captcha check. The form itself shows up. The captcha does not. So I know that the javascript (posted below) gets what I want it to get. But there's something wrong that is keeping my captcha from showing up.
Just as a final note, I'm targetting a div with the id "splashTarget" I use CSS to arrange everything how I want it. I'm not going to post that because its probably not relevant, but if you think I do need to post it to get help let me know.
::CODE::
The form that doesn't seem to work:
<div class="splash"> </div>
<div style="text-align:left" id="registrationSplash" class="splashContent">
<div style="text-align:right">
<a style="color:darkred" href="javascript:closeSplash()">[ CANCEL ]</a>
</div>
<h1>REGISTER</h1>
<form action="" method="post" id="registerForm">
<?PHP
require_once('recaptchalib.php');
$publickey = "[censored]";
echo recaptcha_get_html($publickey);
echo '<!--'.recaptcha_get_html($publickey).'-->';
?>
<table>
<tr>
<td>First Name:</td>
<td><input type="text" name="firstname" maxlength="60"></td>
<td>Username:</td>
<td><input type="text" name="username" maxlength="30"></td>
</tr>
<tr>
<td>Last Name:</td>
<td><input type="text" name="lastname" maxlength="60"></td>
<td>Password:</td>
<td><input type="password" name="pass" maxlength="30"></td>
</tr>
<tr>
<td>E-mail Address:</td>
<td><input type="text" name="firstname" maxlength="60"></td>
<td>Confirm Password:</td>
<td><input type="password" name="pass2" maxlength="30"></td>
</tr>
<tr>
<th colspan=4 style="text-align:right">
<button onclick="submitFormRegisterSplash()" type="button" name="submit" value="Login">Register!</button>
</th>
</tr>
</table>
</form>
<div id="status" />
</div>
The actual call to recaptia.
<?PHP
require_once('recaptchalib.php');
$publickey = "[censored]";
echo recaptcha_get_html($publickey);
echo '<!--'.recaptcha_get_html($publickey).'-->';
?>
Javascript Function used to load Register form:
function onRegisterClicked() {
var onRegisterClickedHttp;
if(window.XMLHttpRequest) {
onRegisterClickedHttp = new XMLHttpRequest();
onRegisterClickedHttp.onreadystatechange = function() {
if(onRegisterClickedHttp.readyState==4 && onRegisterClickedHttp.status==200) {
var response = onRegisterClickedHttp.responseText;
document.getElementById("splashTarget").innerHTML = response;
}
}
}
onRegisterClickedHttp.open("GET", "Verification/RegisterSplash.php", true);
onRegisterClickedHttp.send();
}
Result on Webpage after calls to create
<div id="splashTarget">
<div class="splash"> </div>
<div style="text-align:left" id="registrationSplash" class="splashContent">
<div style="text-align:right">
<a style="color:darkred" href="javascript:closeSplash()">[ CANCEL ]</a>
</div>
<h1>REGISTER</h1>
<form action="" method="post" id="registerForm">
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=6LehEsgSAAAAAAH2xfKSXKSdldMwoiOqZyO5TupV"></script>
<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k=6LehEsgSAAAAAAH2xfKSXKSdldMwoiOqZyO5TupV" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript><!--<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=6LehEsgSAAAAAAH2xfKSXKSdldMwoiOqZyO5TupV"></script>
<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k=6LehEsgSAAAAAAH2xfKSXKSdldMwoiOqZyO5TupV" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>--> <table>
<tbody><tr>
<td>First Name:</td>
<td><input type="text" name="firstname" maxlength="60"></td>
<td>Username:</td>
<td><input type="text" name="username" maxlength="30"></td>
</tr>
<tr>
<td>Last Name:</td>
<td><input type="text" name="lastname" maxlength="60"></td>
<td>Password:</td>
<td><input type="password" name="pass" maxlength="30"></td>
</tr>
<tr>
<td>E-mail Address:</td>
<td><input type="text" name="firstname" maxlength="60"></td>
<td>Confirm Password:</td>
<td><input type="password" name="pass2" maxlength="30"></td>
</tr>
<tr>
<th colspan="4" style="text-align:right">
<button onclick="submitFormRegisterSplash()" type="button" name="submit" value="Login">Register!</button>
</th>
</tr>
</tbody></table>
</form>
<div id="status">
</div>
</div></div>
The Website in action is gumonshoe dot net slash Registration
You'll need to choose to try to register to see the pop up. I disabled the CSS that created the splash screen thinking that it might have been an issue with z-indexes. That doesn't appear to be the case.
Thanks for any tips.
The form HTML DOES work (see http://jsfiddle.net/5p5K3/). The error is caused by a feature:
<script> tags which are injected using .innerHTML = .... <script> are not parsed (functions and variables inside these tags are not defined, nor called). You have to include the CAPTCHA code inside the page, instead of adding it using AJAX.
EDIT
Add this HTML code (inside the <head> block):
<script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>
Overwrite your function by my suggestion (replace <PUBLIC kEY HERE> by your public key):
function onRegisterClicked() {
Recaptcha.create("<PUBLIC KEY HERE>", "splashTarget", {
theme: "red",
callback: Recaptcha.focus_response_field
});
}
Obvious problem: The inserted recaptcha code is commented out with <!-- -->. Commented-out html/js is NOT going to be rendered/executed. Change
echo '<!--'.recaptcha_get_html($publickey).'-->';
to
echo recaptcha_get_html($publickey);

handling checkbox values in email form with php

I have gone through a bunch of question posts, and found one person with the same issue as me, but the answer he/she received I did not find to help at all.
I created a form which uses checkboxes. Once submitted my entire form is processed beautifully and I do receive the mail, but when it comes to the checkboxes it only displays "Array" in the email in stead of the checked checkbox values....
What am I doing wrong?
HTML Form Code: as requested, the full form
<form name="busquoteform" method="post" action="FormToEmail.php">
<fieldset>
<legend>Contact Information</legend>
<table width="100%">
<tr>
<td width="40%">
<label><strong>Name *:</strong></label><br/>
<input name="name" type="text" id="name" value="" />
</td>
<td width="10%"> </td>
<td width="40%">
<label><strong>Lastname *:</strong></label><br />
<input name="lname" type="text" id="lname" value="" />
</td>
</tr>
</table>
<table width="100%">
<tr>
<td width="25%">
<label><strong>Contact Number:</strong></label><br/>
<input name="contactno" type="text" id="contactno" value="" />
</td>
<td width="25%">
<label><strong>Mobile Number * </strong></label><br/>
<input name="mobno" type="text" id="mobno" value="" />
</td>
<td width="40%">
<label><strong>Email *:</strong></label><br/>
<input name="email" type="text" id="email" value="" />
</td>
</tr>
</table>
</fieldset>
<br/>
<fieldset>
<legend>Company Information</legend>
<table width="100%">
<tr>
<td width="40%">
<label><strong>Company Name *:</strong></label><br/>
<input name="compname" type="text" id="compname" value="" />
</td>
<td width="10%">
<label><strong>Position Held *:</strong></label><br />
<input name="position" type="text" id="position" value="" />
</td>
<td width="40%">
</td>
</tr>
</table>
<table width="100%">
<tr>
<td width="16%">
<label><strong>Company Address*:</strong></label><br/><br/><br/><br/>
</td>
<td width="2%">
</td>
<td>
<input name="street" type="text" id="street" value="Street" size="30" /><br/>
<input name="suburb" type="text" id="suburb" value="Suburb" size="30" /><br/>
<input name="city" type="text" id="city" value="City" size="30" /><br/>
<input name="code" type="text" id="code" value="Postal Code" size="10" /><br/>
</td>
</tr>
</table>
</fieldset>
<br/>
<fieldset>
<legend>Project Information</legend>
<table>
<tr>
<td>
<label><strong>Service Type/s*:</strong></label><br/>
Please select all applicable types.
</td>
</tr>
<tr>
<td>
Graphic Design <input name="serviceType[]" id="design" type="checkbox" value="Graphic Design" />
Web Development <input name="serviceType[]" id="webdev" type="checkbox" value="Web Development" />
Application Development <input name="serviceType[]" id="appdev" type="checkbox" value="App Development" />
Embroidery <input name="serviceType[]" id="embroidery" type="checkbox" value="Embroidery" />
Engraving <input name="serviceType[]" id="engrave" type="checkbox" value="Engraving" /><br/><br/>
</td>
</tr>
<tr>
<td>
<label><strong>Please supply a detailed description of your requirements*:</strong></label><br/>
<textarea name="projectDes" cols="60" rows="10" id="projectDes"></textarea>
<br/><br/>
<input name="quoteBus" type="submit" class="ZD-button" value="Send Request"/>
</td>
</tr>
</table>
</fieldset>
</form>
and the php processing code:
$mailBody = "Name : ".$_REQUEST['name']. " ".$_REQUEST['lname'].
" <br/>Email : ".$_REQUEST['email'].
" <br/>Contact No : ".$_REQUEST['contactno']. " Mobile No: ".$_REQUEST['mobno'].
"<br/><br/>Company Name : ".$_REQUEST['compname'].
" <br/>Postion Held : ".$_REQUEST['position'].
"<br/><br/>Company Address : <br/>".$_REQUEST['street']."<br/>".$_REQUEST['suburb']."<br/>".$_REQUEST['city']."<br/>".$_REQUEST['code'].
"<br/><br/> Service Type/s :" .(is_array($_REQUEST['serviceType'])?implode("\n", $_REQUEST['serviceType']):$_REQUEST['serviceType'])."<br />".
"<br/><br/>Details of Project : ".$_REQUEST['projectDes'];
I've also tried:
" Service Type/s :" .$serviceType = $_POST["serviceType"];$serviceType = implode(', ', $serviceType);"".
and also does not seem to work...
I got this code from a project my hubby did a while back - but he is not a php developer, he's into Java...
Help Please?
Update
I just tried your code and it works fine, and results what you want. So can you please show your <form> tag.
Code that I tested
<?php
echo (is_array($_REQUEST['serviceType']) ? implode("\n", $_REQUEST['serviceType']) : $_REQUEST['serviceType']);
?>
<form action="" method="post">
Graphic Design <input name="serviceType[]" id="design" type="checkbox" value="Graphic Design" />
Web Development <input name="serviceType[]" id="webdev" type="checkbox" value="Web Development" />
Application Development <input name="serviceType[]" id="appdev" type="checkbox" value="App Development" />
Embroidery <input name="serviceType[]" id="embroidery" type="checkbox" value="Embroidery" />
Engraving <input name="serviceType[]" id="engrave" type="checkbox" value="Engraving" /><br/><br/>
<input type="submit" />
</form>
Hm, that's strange.. It should show all the serviceType values seperated by \n, due to this line:
(is_array($_REQUEST['serviceType'])?implode("\n", $_REQUEST['serviceType']):$_REQUEST['serviceType'])
What if you change $_REQUEST to $_POST?
You can use foreach this way:
$serviceTypes = "";
if (is_array($_REQUEST['serviceType']))
{
foreach ($_REQUEST['serviceType'] as $serviceType)
{
$serviceTypes.= "$serviceType\n";
}
}
It's a possibility.

Categories