Page 1 of 2

Need Help to change input type the value?

Posted: Fri Jun 13, 2014 6:02 am
by EdeniTX
Ok i created a form everything works great except one thing that bothers me is once the data is sent to my email i receive the information firs_name, last_name with underscore and lower case. I would like to change that to FIRST NAME: Capital if possible or First Name: without no underscore, can someone please help me out on this i been searching a lot for this answer and have not found one yet.

This is how i have it and it does not let me change the input by First Name: only works as it is

<input name="First_Name" type="text" class="auto-style39" />

Re: Need Help to change input type the value?

Posted: Fri Jun 13, 2014 7:05 am
by Celauran
Don't change it in the form, change it where you're mailing it out. Use a str_replace or preg_replace to remove the underscores in the $_POST array keys.

Re: Need Help to change input type the value?

Posted: Fri Jun 13, 2014 8:19 am
by anant123
$str = strtoupper($str); and str_replace(find,replace,string) use this 2 functions

Re: Need Help to change input type the value?

Posted: Fri Jun 13, 2014 4:05 pm
by EdeniTX
Thank You so much for responding back. I am still new at this i am a bit confused as i do not know much about these $str = strtoupper($str); and str_replace(find,replace,string) use this 2 functions like where would i place them which section sorry i am a bit slow on this but i am trying to learn and i am using CGI Script to receive the data through out my webhosting if that matters.

Re: Need Help to change input type the value?

Posted: Fri Jun 13, 2014 4:28 pm
by Celauran
If you post the code where the form is being processed, we can show you exactly what changes to make.

Take a look at the PHP manual for strtoupper() and str_replace()

Re: Need Help to change input type the value?

Posted: Fri Jun 13, 2014 4:33 pm
by EdeniTX
Celauran wrote:If you post the code where the form is being processed, we can show you exactly what changes to make.

Take a look at the PHP manual for strtoupper() and str_replace()
This is the whole code of my Form.

<form action="" method="post" style="height: 1269px" name="RESERVATIONS">
<br class="auto-style30" />
<br class="auto-style30" />
<br class="auto-style30" />
<span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br />
<br />
<span class="auto-style35"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;..:: RESERVATIONS ::..&nbsp;<br />
</strong></span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span class="auto-style36">&nbsp; Please fill out all
required fields marked with *<br />
</span><br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span class="auto-style37"><strong>PLEASE CHECK ONE </strong>
</span></span> <br class="auto-style30" />
<br class="auto-style30" />
<label id="Label9"><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ONE WAY TRIP&nbsp;
</span>
<input name="One_Way" type="checkbox" class="auto-style39" value="One_Way" /><span class="auto-style30"><label id="Label10">&nbsp;&nbsp; ROUND
TRIP&nbsp; </label></span>
<input name="One_Way" type="checkbox" class="auto-style39" value="One_Way" /></label><br class="auto-style30" />
<br class="auto-style30" />
<span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FIRST NAME*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<input name="First_Name" type="text" class="auto-style39" /><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<label id="Label1"><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp; LAST NAME*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<input name="Last_Name" type="text" class="auto-style39" /></label><br class="auto-style30" />
<br class="auto-style30" />
<label id="Label2"><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMPANY NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<input name="Company_Name" type="text" class="auto-style39" /><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMPANY PHONE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span> <label id="Label3">
<label id="Label4">
<input name="Work_Phone" type="text" class="auto-style39" /><br class="auto-style30" />
<br class="auto-style30" />
<label id="Label5"><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CELL PHONE*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<input name="Cell_Phone" type="text" class="auto-style39" /><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<label id="Label6"><span class="auto-style30">&nbsp;&nbsp;&nbsp;
EMAIL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><input name="Email" type="text" class="auto-style32" /></label></label></label></label></label><br class="auto-style30" />
<br class="auto-style30" />
<label id="Label7"><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TYPE OF SERVICE*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<input name="Service_Type" type="text" class="auto-style39" /><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<label id="Label8"><label id="Label11">
<span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp; NUMBER
OF PASSENGERS*&nbsp;&nbsp;&nbsp;&nbsp; </span>
<input class="auto-style40" name="Number_of_Passengers" type="text" /></label></label><span class="auto-style30">
</span>
</label><br class="auto-style30" />
<br class="auto-style30" />
<label id="Label12"><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
PICK UP DATE*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<input class="auto-style39" name="Pick_Up_Date" type="text" /><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><label id="Label13"><span class="auto-style30">&nbsp;&nbsp;&nbsp;
PICK UP TIME*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<input class="auto-style39" name="Pick_Up_Time" type="text" /></label></label><br class="auto-style30" />
<br class="auto-style30" />
<label id="Label14"><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DROP OFF TIME*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<input class="auto-style39" name="Drop_Off_Time" type="text" /><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><label id="Label15"><span class="auto-style30">&nbsp;&nbsp;
TYPE OF VEHICLE*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<select class="auto-style40" name="Vehicle_Type" style="width: 154px">
<option selected="selected">Please Select</option>
<option>3 Passengers - Town Car Sedan</option>
<option>7 Passengers - Chevy Suburban</option>
<option>4 Passengers - Merdeces S550</option>
<option>11 Passengers - Mercedes Sprinter</option>
<option>14 Passengers - Passenger Vans</option>
<option>6-10 Passemgers - Limousines</option>
<option>16 Passengers - Stretch H2 Hummer White</option>
<option>16 Passengers - Stretch H2 Hummer Black</option>
<option>18 Passengers - Stetch Escalade</option>
<option>16 Passengers - Stretch Excursion</option>
<option>30-35 Passengers - Limo Bus</option>
<option>28 Passengers - Shuttle Bus</option>
<option>56 Passengers - Motor Coach Bus</option>
</select></label></label><br class="auto-style30" />
<br class="auto-style30" />
<label id="Label16"><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
PICK UP ADRESS:*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<textarea class="auto-style34" name="Pick_Up_Address" style="width: 570px; height: 106px"></textarea><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;
<br />
</span><label id="Label17"><span class="auto-style30"><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DROP OFF ADDRESS*&nbsp;&nbsp;&nbsp;&nbsp;
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<strong>
<textarea class="auto-style41" name="Drop_Off_Address" style="width: 570px; height: 101px"></textarea></strong></label></label><br class="auto-style30" />
<br class="auto-style30" />
<label id="Label18"><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
AIRLINE&FLIGHT#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><input class="auto-style39" name="Airline" type="text" /><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><label id="Label19"><span class="auto-style30">
AIRPORT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<select class="auto-style39" name="Airport" style="width: 154px">
<option selected="selected">Optional</option>
<option>George Bush Intercontinental Airport</option>
<option>William P. Hobby Airport</option>
</select></span></label></label><br class="auto-style30" />
<br class="auto-style30" />
<label id="Label20"><span class="auto-style30">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OTHER INFORMATION<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>
<strong>
<textarea class="auto-style43" name="Other_Information" style="width: 570px; height: 101px">For trips including multiple stops, please provide the full address for each. Also, please include detailed instructions for any special requests.</textarea></strong></label><br class="auto-style30" />
<br class="auto-style30" />
<br />
<br class="auto-style30" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<strong>
<input class="auto-style42" style="width: 114px" type="submit" value="SUBMIT" /></strong><br class="auto-style30" />
<br class="auto-style30" />

<input type=hidden name="recipient" value="info@edenslimousine.com">
<input type=hidden name="required" value="First_Name,Last_Name,Cell_Phone,Email,Service_Type,Number_of_Passengers,Pick_Up_Date,Pick_Up_Time,Drop_Off_Time,Vehicle_Type,Pick_Up_Address,Drop_Off_Address">
<input type=hidden name="missing_fields_redirect"value="http://edenslimousine.com/Error/Error.html">
<input type=hidden name="redirect" value="http://edenslimousine.com/Success/Success.html">
<input type=hidden name="env_report" value="REMOTE_HOST,HTTP_USER_AGENT">
<input type=hidden name="subject" value="Reservation">
</form>

Re: Need Help to change input type the value?

Posted: Fri Jun 13, 2014 4:37 pm
by EdeniTX
My form is created in HTML, i used Expression Web 4.0

Re: Need Help to change input type the value?

Posted: Fri Jun 13, 2014 4:57 pm
by Celauran
It's not the form itself we need so much as the code that processes the form after submission.

Re: Need Help to change input type the value?

Posted: Fri Jun 13, 2014 5:06 pm
by EdeniTX
I am using the CGI Script from my webhosting HostGator.com everything is being processed through CGI. Is that what you are talking about?

Re: Need Help to change input type the value?

Posted: Fri Jun 13, 2014 5:09 pm
by EdeniTX
Image

Image

<input type=hidden name="recipient" value="info@edenslimousine.com">
<input type=hidden name="required" value="First_Name,Last_Name,Cell_Phone,Email,Service_Type,Number_of_Passengers,Pick_Up_Date,Pick_Up_Time,Drop_Off_Time,Vehicle_Type,Pick_Up_Address,Drop_Off_Address">
<input type=hidden name="missing_fields_redirect"value="http://edenslimousine.com/Error/Error.html">
<input type=hidden name="redirect" value="http://edenslimousine.com/Success/Success.html">
<input type=hidden name="env_report" value="REMOTE_HOST,HTTP_USER_AGENT">
<input type=hidden name="subject" value="Reservation">


This is how i have it?

Re: Need Help to change input type the value?

Posted: Fri Jun 13, 2014 5:40 pm
by Celauran
Wow. Haven't seen a CGI script in ages. All of our suggestions above are now irrelevant. Are you able to edit the CGI script? If not, you may just need to live with first_name as that's where it's being processed.

Re: Need Help to change input type the value?

Posted: Fri Jun 13, 2014 5:48 pm
by EdeniTX
Celauran wrote:Wow. Haven't seen a CGI script in ages. All of our suggestions above are now irrelevant. Are you able to edit the CGI script? If not, you may just need to live with first_name as that's where it's being processed.

Do you know any useful link where it shows how to create a PHP form, because i really want to change this.

Re: Need Help to change input type the value?

Posted: Fri Jun 13, 2014 7:09 pm
by Celauran
The form itself doesn't need changing. You just need to remove the reference to the CGI and add some processing to it. In short, check if $_POST contains values (ie. the form has been submitted), then perform whatever operations you need to on those fields.

A quick and dirty example would be something like this:

Code: Select all

if (!empty($_POST)) {
	$text = '';
	
	foreach ($_POST as $key => value) {
		$text .= strtoupper(str_replace('_', ' ', $key)) . ": {$value}\n";
	}

	$to = $_POST['recipient'];
	$subject = $_POST['subject'];

	mail($to, $subject, $text);
}

Re: Need Help to change input type the value?

Posted: Fri Jun 13, 2014 10:00 pm
by EdeniTX
Celauran wrote:The form itself doesn't need changing. You just need to remove the reference to the CGI and add some processing to it. In short, check if $_POST contains values (ie. the form has been submitted), then perform whatever operations you need to on those fields.

A quick and dirty example would be something like this:

Code: Select all

if (!empty($_POST)) {
	$text = '';
	
	foreach ($_POST as $key => value) {
		$text .= strtoupper(str_replace('_', ' ', $key)) . ": {$value}\n";
	}

	$to = $_POST['recipient'];
	$subject = $_POST['subject'];

	mail($to, $subject, $text);


Great. So do i need to add anything in between this code that you posted here. I remove the CGI Mail thing and then where do i paste this part that you post and where do i add stuff can you please provide an example with some text where to and how to. That would help me understand this better God all these numbers and codes confuse the heck out of me but i really want to learn how does it work i have to see it in order to learn it then i can practice it more later.
}

Re: Need Help to change input type the value?

Posted: Sat Jun 14, 2014 9:02 am
by Celauran
If you're just getting started, check out PHP: The Right Way. Most PHP tutorials online, unfortunately, are terrible; out of date, full of bad practices, and generally written by people who don't really know what they're talking about. This is one of the very few good ones and should serve you well.

As for the bit of code I posted above, the body of the email is being stored in the variable $text before being passed to the mail() function. You can add whatever text you like before or after the form fields by simply appending to the variable. Place the block of code at the top of your PHP file.

Code: Select all

<?php
if (!empty($_POST)) {
        $text = '';
        
        $text .= "This text will appear at the beginning of the email body.";

        // This loop will add ALL the form's values to your email
        foreach ($_POST as $key => value) {
                $text .= strtoupper(str_replace('_', ' ', $key)) . ": {$value}\n";
        }

        $text .= "This text will be appended after the form fields.";

        $to = $_POST['recipient'];
        $subject = $_POST['subject'];

        mail($to, $subject, $text);
}