PDA

View Full Version : PHP moron...


Eliteoomph
01-05-2011, 05:01 AM
Hey guys,

I know very very little about php.
I need to put together a form that looks like this.
http://nancyoates.com/property_request.shtml
I have seen a bunch of free form builders online where you
can get so many free submissions per months like this
http://wufoo.com/ and I have
also come across some software like this
http://phpforms.net/

I ultimately would to learn PHP and just do it myself
but I will need these forms faster then I could learn
the language.

What would you guys suggest be the best method for what
I am trying to accomplish?

Thanks

edbr
01-05-2011, 05:04 AM
forms are html and you use php to send the mail, two different entities

Eliteoomph
01-05-2011, 05:08 AM
Yeah surprisingly enough i knew that much...
I can make a table and a form in dreamweaver... I just don't know how to use a PHP script to email the form to myself...

edbr
01-05-2011, 05:24 AM
there is a mail script on this forum to get you going look in tuttorials

Eliteoomph
01-05-2011, 05:27 AM
will do!
Thanks!

Eliteoomph
01-05-2011, 06:14 AM
I read over the tutorial "Using Dreamweaver and PHP to send form results in an e-mail"

I have a standard contact form on my site that is very similar to this one.
But the one I need to use is a lot more in depth then this and includes dropdowns, check boxes etc...

Does the phpscript change with the html form?

I have learned mostly what I know now about form by viewing sources on multiple pages and copying forms and then playing around with them in dreamweaver but you can't always view the script file that they are linked too...

edbr
01-05-2011, 06:21 AM
if you have multiple choice it will need modifying but that has been answered here a few times

Eliteoomph
01-05-2011, 06:39 AM
This is the php file I use for my simple contact form

<?php
/*

Author: Andrew Walsh
Date: 30/05/2006
Codewalkers_Username: Andrew


This script is a basic contact form which uses AJAX to pass the information to php, thus making the page appear to work without any refreshing or page loading time.

*/

$to = "insertemailhere"; //This is the email address you want to send the email to
$subject_prefix = "Email from Website"; //Use this if you want to have a prefix before the subject

if(!isset($_GET['action']))
{
die("You must not access this page directly!"); //Just to stop people from visiting contact.php normally
}

/* Now lets trim up the input before sending it */

$name = trim($_GET['name']); //The senders name
$email = trim($_GET['email']); //The senders email address
$subject = trim($_GET['subject']); //The senders subject
$message = trim($_GET['msg']); //The senders message

mail($to,$subject,$message,"From: ".$email.""); //a very simple send

echo 'contactarea|Thank you '.$name.', your email has been sent.'; //now lets update the "contactarea" div on the contact.html page. The contactarea| tell's the javascript which div to update.
?>


Here is the contact form that I wish to replicate.
http://nancyoates.com/property_request.shtml

Is this something that is possible for someone like me to do or do I need to hire a professional?

edbr
01-05-2011, 07:06 AM
the for is just a form you can style with css, you got that already.
they use post to pass the variables which i also would
you need to collect the post variables and add them to $message
i dont want to confuse you here as it is not that difficult when you get into it, but it really depends on the time you are prepared to commit
oh the check boxes need to be an array but as i said thats explained already here . it is really up to you

edbr
01-05-2011, 07:09 AM
just a point or two more, you may want to add some anti spam validation (captcha perhaps0 and modifying to add requiredfields

Eliteoomph
01-05-2011, 07:18 AM
man the subject of this thread is so true...
What is a post Variable?
could you give me and example? and the same for the array for checkboxes.
I guess it sounds like another language because it is...:lol:

Eliteoomph
01-05-2011, 07:34 AM
I have read up on checkbox arrays a little and from what i can tell it is just a way of cleaning up the code a little so to use a single array for all the checkboxes in a group so that you don't have to assign all of them a different name... Is this correct?
I am ok with them being different names right now... my main priority is just to figure out a way to email the form.
Say I take the form html off that website and replace
<form action="/servlets/basic.OraclePassalong?applyTo=clients/real_estate/ae_forms/property_request.zml" method="post" target="_parent" onsubmit="return checkForm(this);">

with this

<form action="sendmail.php" method="post" target="_parent" onsubmit="return checkForm(this);">
my PHP file....

am I heading in the right direction?

Eliteoomph
01-05-2011, 07:38 AM
yes I had been thinking about modifying to add the required fields...
I am happy just to have a similar thought that you had ;o)

edbr
01-05-2011, 07:57 AM
will need more time than i have just now , post the whole form and perhaps we can guide you from there

Eliteoomph
01-05-2011, 08:05 AM
here yah go.... its a long one...
this is 1 of 2

<!-- Form to follow -->
<script type="text/javascript">
<!--
var expDays = 180;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function SetCookie (name, value)
{
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}

function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1) { endstr = document.cookie.length; }
return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
{
return getCookieVal (j);
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}

function cookieCheck(theForm)
{
if(theForm.REMEMBERME.checked)
{
if (GetCookie('name') == null)
{
SetCookie('fname', theForm.FNAME.value, exp);
SetCookie('lname', theForm.LNAME.value, exp);
SetCookie('name', theForm.FNAME.value + '' + theForm.LNAME.value, exp);
SetCookie('email', theForm.EMAIL.value, exp);
SetCookie('phone', theForm.PHONE.value, exp);
}
} else {
var exp2 = new Date();
SetCookie('name', '', exp2);
}
}
function checkForm(theForm)
{
if(theForm.FNAME.value == "")
{
alert("Please enter your first name.");
theForm.FNAME.focus();
return false;
}
else if(theForm.LNAME.value == "")
{
alert("Please enter your last name.");
theForm.LNAME.focus();
return false;
}
else if(theForm.EMAIL.value == "")
{
alert("Please enter your email.");
theForm.EMAIL.focus();
return false;
}
else if(theForm.EMAIL.value.indexOf("@") == -1)
{
alert("Please enter a valid email address.");
theForm.EMAIL.focus();
return false;
} else if(!(theForm.LNAME.value == "") && !(theForm.LNAME.value == ""))
{
theForm.NAME.value = theForm.FNAME.value+" "+theForm.LNAME.value;
}
cookieCheck(theForm);
document.getElementById('submit_button').style.dis play = 'none';
document.getElementById('wait').style.display = 'block';
return true;
}
//-->
</script>

edbr
01-05-2011, 08:06 AM
no thats the validation

Eliteoomph
01-05-2011, 08:08 AM
2 of 2

<form action="/servlets/basic.OraclePassalong?applyTo=clients/real_estate/ae_forms/property_request.zml" method="post" target="_parent" onsubmit="return checkForm(this);">
<input type="hidden" name="RID" value="gg5iozbl01q" />
<input type="hidden" id="NAME" name="NAME" value="" />
<table border="0" cellspacing="1" cellpadding="1" width="600" id="formtable">
<tr>
<td>
<div class="backgroundprop">
<table border="0">
<tr>
<td colspan="2" class="header01">
Contact Information
</td>
</tr>
<tr>
<td align="right" class="label01">
<span class="required">*</span> First Name:
</td>
<td class="field01">
<input id="FNAME" name="FNAME" size="20" maxlength="100" type="text" />
</td>
</tr>
<tr>
<td align="right" class="label02">
<span class="required">*</span> Last Name:
</td>
<td class="field02">
<input id="LNAME" name="LNAME" size="20" maxlength="100" type="text" />
</td>
</tr>
<tr>
<td align="right" class="label01">
<span class="required">*</span> Email:
</td>
<td class="field01">
<input id="EMAIL" name="EMAIL" size="25" maxlength="160" type="text" />
</td>
</tr>
<tr>
<td align="right" class="label02"> Phone:
</td>
<td class="field02">
<input id="PHONE" name="PHONE" size="15" maxlength="40" type="text" />
</td>
</tr>
<tr>
<td align="right" class="label01">
Address:
</td>
<td class="field01">
<input type="text" name="ADDRESS" />
</td>
</tr>
<tr>
<td align="right" class="label02">
City:
</td>
<td class="field02">
<input type="text" name="CITY" />
</td>
</tr>
<tr>
<td align="right" class="label01">
State:
</td>
<td class="field01">
<select name="STATE">
<option value=""></option>
<option value="AK">AK</option>
<option value="AL">AL</option>
<option value="AR">AR</option>
<option value="AZ">AZ</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DE">DE</option>
<option value="FL">FL</option>
<option value="GA">GA</option>
<option value="HI">HI</option>
<option value="IA">IA</option>
<option value="ID">ID</option>
<option value="IL">IL</option>
<option value="IN">IN</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="MA">MA</option>
<option value="MD">MD</option>
<option value="ME">ME</option>
<option value="MI">MI</option>
<option value="MN">MN</option>
<option value="MO">MO</option>
<option value="MS">MS</option>
<option value="MT">MT</option>
<option value="NC">NC</option>
<option value="ND">ND</option>
<option value="NE">NE</option>
<option value="NH">NH</option>
<option value="NJ">NJ</option>
<option value="NM">NM</option>
<option value="NV">NV</option>
<option value="NY">NY</option>
<option value="OH">OH</option>
<option value="OK">OK</option>
<option value="OR">OR</option>
<option value="PA">PA</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="SD">SD</option>
<option value="TN">TN</option>
<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="VA">VA</option>
<option value="VT">VT</option>
<option value="WA">WA</option>
<option value="WI">WI</option>
<option value="WV">WV</option>
<option value="WY">WY</option>
</select>
Zip: <input name="ZIP" size="10" />
</td>
</tr> <tr>
<td align="right" class="label02">
<small>Please send me updates:</small>
</td>
<td class="field02">
<input type="checkbox" name="SENDDRIP" value="Y" checked="checked" />
</td>
</tr>
<tr>
<td colspan="2" class="header01">
General Information About Your Move
</td>
</tr>
<tr>
<td align="right" class="label01">
Where are you moving?
</td>
<td class="field01">
<input type="text" name="CITYMOV" />
</td>
</tr>
<tr>
<td align="right" class="label02">
State:
</td>
<td class="field02">
<select name="STATEMOV">
<option value=""></option>
<option value="AK">AK</option>
<option value="AL">AL</option>
<option value="AR">AR</option>
<option value="AZ">AZ</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DE">DE</option>
<option value="FL">FL</option>
<option value="GA">GA</option>
<option value="HI">HI</option>
<option value="IA">IA</option>
<option value="ID">ID</option>
<option value="IL">IL</option>
<option value="IN">IN</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="MA">MA</option>
<option value="MD">MD</option>
<option value="ME">ME</option>
<option value="MI">MI</option>
<option value="MN">MN</option>
<option value="MO">MO</option>
<option value="MS">MS</option>
<option value="MT">MT</option>
<option value="NC">NC</option>
<option value="ND">ND</option>
<option value="NE">NE</option>
<option value="NH">NH</option>
<option value="NJ">NJ</option>
<option value="NM">NM</option>
<option value="NV">NV</option>
<option value="NY">NY</option>
<option value="OH">OH</option>
<option value="OK">OK</option>
<option value="OR">OR</option>
<option value="PA">PA</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="SD">SD</option>
<option value="TN">TN</option>
<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="VA">VA</option>
<option value="VT">VT</option>
<option value="WA">WA</option>
<option value="WI">WI</option>
<option value="WV">WV</option>
<option value="WY">WY</option>
</select>
Zip: <input type="text" size="10" name="ZIPMOV" />
</td>
</tr>
<tr>
<td align="right" class="label01">
When do you anticipate purchasing your new home?
</td>
<td class="field01">
<select name="BUYINGWHEN" size="1">
<option value="Not Selected">select one</option>
<option value="Within 4 months">within 4 months</option>
<option value="Within 6 months">within 6 months</option>
<option value="Within a year">within a year</option>
<option value="No date set">no date set</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" class="header01">
Information About The Home You Are Looking For
</td>
</tr>
<tr>
<td align="right" class="label02">
Type of Home:
</td>
<td class="field02">
<select name="HOMETYPE">
<option value="Single Family">Single Family</option>
<option value="Condo/Townhouse">Condo/Townhouse</option>
<option value="Multi-family">Multi-family </option>
<option value="Mobile Home">Mobile Home</option>
<option value="Farm">Farm</option>
<option value="Land Only">Land Only </option>
</select>
</td>
</tr>
<tr>
<td align="right" class="label01">
Approximately priced between:
</td>
<td class="field01">
<select name="MINPRICE" size=1>
<option value="Not Selected">select one</option>
<option value="0">$0
<option value="10000">$10,000
<option value="20000">$20,000
<option value="30000">$30,000
<option value="40000">$40,000
<option value="45000">$45,000
<option value="50000">$50,000
<option value="55000">$55,000
<option value="60000">$60,000
<option value="70000">$70,000
<option value="75000">$75,000
<option value="100000">$100,000
<option value="125000">$125,000
<option value="150000">$150,000
<option value="175000">$175,000
<option value="200000">$200,000
<option value="225000">$225,000
<option value="250000">$250,000
<option value="275000">$275,000
<option value="300000">$300,000
<option value="325000">$325,000
<option value="350000">$350,000
<option value="400000">$400,000
<option value="450000">$450,000
<option value="500000">$500,000
<option value="550000">$550,000
<option value="600000">$600,000
<option value="650000">$650,000
<option value="700000">$700,000
<option value="750000">$750,000
<option value="800000">$800,000
<option value="850000">$850,000
<option value="900000">$900,000
<option value="1000000">$1,000,000
<option value="1250000">$1,250,000
<option value="1500000">$1,500,000
<option value="1750000">$1,750,000
<option value="2000000">$2,000,000
<option value="2250000">$2,250,000
<option value="2500000">$2,500,000
<option value="2750000">$2,750,000
<option value="3000000">$3,000,000
<option value="3500000">$3,500,000
<option value="4000000">$4,000,000
<option value="4500000">$4,500,000
<option value="5000000">$5,000,000
<option value="6000000">$6,000,000
<option value="8000000">$8,000,000
<option value="10000000">$10,000,000
</select>
and
<select name="MAXPRICE" size=1>
<option value="Not Selected">select one</option>
<option value="10000">$10,000
<option value="20000">$20,000
<option value="30000">$30,000
<option value="40000">$40,000
<option value="45000">$45,000
<option value="50000">$50,000
<option value="55000">$55,000
<option value="60000">$60,000
<option value="70000">$70,000
<option value="75000">$75,000
<option value="100000">$100,000
<option value="125000">$125,000
<option value="150000">$150,000
<option value="175000">$175,000
<option value="200000">$200,000
<option value="225000">$225,000
<option value="250000">$250,000
<option value="275000">$275,000
<option value="300000">$300,000
<option value="325000">$325,000
<option value="350000">$350,000
<option value="400000">$400,000
<option value="450000">$450,000
<option value="500000">$500,000
<option value="550000">$550,000
<option value="600000">$600,000
<option value="650000">$650,000
<option value="700000">$700,000
<option value="750000">$750,000
<option value="800000">$800,000
<option value="850000">$850,000
<option value="900000">$900,000
<option value="1000000">$1,000,000
<option value="1250000">$1,250,000
<option value="1500000">$1,500,000
<option value="1750000">$1,750,000
<option value="2000000">$2,000,000
<option value="2250000">$2,250,000
<option value="2500000">$2,500,000
<option value="2750000">$2,750,000
<option value="3000000">$3,000,000
<option value="3500000">$3,500,000
<option value="4000000">$4,000,000
<option value="4500000">$4,500,000
<option value="5000000">$5,000,000
<option value="6000000">$6,000,000
<option value="8000000">$8,000,000
<option value="10000000">$10,000,000
</select>
</td>
</tr>

Eliteoomph
01-05-2011, 08:09 AM
3 of 3 i lied
lol its coming hold your horses

<tr>
<td align="right" class="label02">
Number of Bedrooms:
</td>
<td class="field02">
<select name="BEDROOMS">
<option value="Not Selected">select one</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
</td>
</tr>
<tr>
<td align="right" class="label01">
Number of Bathrooms:
</td>
<td class="field01">
<select name="BATHROOMS">
<option value="Not Selected">select one</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4+">4+</option>
</select>
</td>
</tr>
<tr>
<td align="right" class="label02">
Interior Features &amp; Preferences:
</td>
<td class="field02">
<table cellpadding="0" cellspacing="0">
<tr>
<td nowrap>
<input type="checkbox" name="LIVINGROOM" />Living Room
</td>
<td nowrap>
<input type="checkbox" name="FAMILYROOM" />Family Room
</td>
<td nowrap>
<input type="checkbox" name="FIREPLACE" />Fireplace
</td>
</tr>
<tr>
<td nowrap>
<input type="checkbox" name="HARDWOOD" />Hardwood Floors
</td>
<td nowrap>
<input type="checkbox" name="DEN" />Den / Study
</td>
<td nowrap>
<input type="checkbox" name="LAUNDRY" />Laundry Room
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="right" class="label01">
Other Important Interior Features:
</td>
<td class="field01">
<textarea cols=35 name="OTHERINTERIOR"></textarea>
</td>
</tr>
<tr>
<td align="right" class="label02">
Exterior Features &amp; Preferences:
</td>
<td class="field02">
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<input type="checkbox" name="POOL" />Swimming pool
</td>
<td>
<input type="checkbox" name="SPA" />Spa
</td>
<td>
<input type="checkbox" name="WATERFRONT" />Waterfront
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="GARAGE" />Garage
</td>
<td>
<input type="checkbox" name="TILE" />Tile roof
</td>
<td>
<input type="checkbox" name="FENCED" />Fenced
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="right" class="label01">
Other Important Exterior Features:
</td>
<td class="field01">
<textarea cols=35 name="OTHEREXTERIOR"></textarea>
</td>
</tr>
<tr>
<td colspan="2" class="header01">
Additional Information
</td>
</tr>
<tr>
<td align="right" class="label02">
Have you ever been pre-qualified for a mortgage?
</td>
<td class="field02">
<input type="radio" name="PREQUALIFIED" value="No" />No <input type="radio" name="PREQUALIFIED" value="Yes" />Yes
</td>
</tr>
<tr>
<td align="right" class="label01">
Do you have a down payment?
</td>
<td class="field01">
<input type="radio" name="DOWNPAYMENT" value="No" />No <input type="radio" name="DOWNPAYMENT" value="Yes" />Yes
</td>
</tr>
<tr>
<td align="right" class="label02">
Have you had a credit report done lately?
</td>
<td class="field02">
<input type="radio" name="CREDITREPORT" value="No" />No <input type="radio" name="CREDITREPORT" value="Yes" />Yes
</td>
</tr>
<tr>
<td align="right" class="label01">
Please use this space for any other comments or questions you might have.
</td>
<td class="field01">
<textarea cols=35 name="COMMENTS" rows=5 wrap=VIRTUAL></textarea>
</td>
</tr>
<tr>
<td class="label01"><small>Save my information.</small></td>
<td class="field01"><input type="checkbox" id="REMEMBERME" name="REMEMBERME" checked="checked"></td>
</tr>
<tr>
<td align="right" class="label02">
<small><span class="required">*</span> required field</small>
</td>
<td class="field02">
<div id="submit_button" style="display: block;"><input type="submit" value=" " id="submitprop" class="submit" name="submitty" /></div><div id="wait" style="display: none;" ><b>&nbsp;Your inquiry has been sent.</b></div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<!--extra fields:-->
<input type="hidden" name="EXNAME1" /><input type="hidden" name="EXVAL1" />
<input type="hidden" name="EXNAME2" /><input type="hidden" name="EXVAL2" />
<input type="hidden" name="EXNAME3" /><input type="hidden" name="EXVAL3" />
<input type="hidden" name="EXNAME4" /><input type="hidden" name="EXVAL4" />
<input type="hidden" name="EXNAME5" /><input type="hidden" name="EXVAL5" />
<input type="hidden" name="EXNAME6" /><input type="hidden" name="EXVAL6" />
<input type="hidden" name="EXNAME7" /><input type="hidden" name="EXVAL7" />
<input type="hidden" name="EXNAME8" /><input type="hidden" name="EXVAL8" />
<input type="hidden" name="EXNAME9" /><input type="hidden" name="EXVAL9" />
<input type="hidden" name="EXNAME10" /><input type="hidden" name="EXVAL10" />
<!--end extra fields-->
</form>
<script language="javascript">
<!--
if(GetCookie('name') != null)
{
document.getElementById("NAME").value = GetCookie('name');
}
if(GetCookie('fname') != null)
{
document.getElementById("FNAME").value = GetCookie('fname');
}
if(GetCookie('lname') != null)
{
document.getElementById("LNAME").value = GetCookie('lname');
}
if(GetCookie('email') != null)
{
document.getElementById("EMAIL").value = GetCookie('email');
}
if(GetCookie('phone') != null)
{
document.getElementById("PHONE").value = GetCookie('phone');
}
-->
</script>



<!-- End form -->
I need to have this figured out with in next 24-48 hours lol no pressure ;o)

edbr
01-05-2011, 08:43 AM
that might be tricky as i have yo learn chinese by noon tomorrow

Corrosive
01-05-2011, 08:45 AM
I need to have this figured out with in next 24-48 hours lol no pressure ;o)

Would it ease the pressure if I make a noise like a ticking clock?

Eliteoomph
01-05-2011, 01:34 PM
that might be tricky as i have yo learn chinese by noon tomorrow
lol lucky me I don't have to learn a whole language...
I just need to learn "how to make the form mail out" ;-)

Would it ease the pressure if I make a noise like a ticking clock?
haha yeah... couldn't hurt
as I stated in my first post...
I know I don't have time to learn the whole language.
I just need to know in the amount of time that I have what my options are.
The online form builders are a RIPOFF... This form is so long I can't even use the free versions. I don't know if there is any good php script building software helpers out there that would be helpful or not.
I may even have to resort to paying someone if I can't figure it out.
I just have to figure something out:confused:

edbr
01-06-2011, 12:02 AM
i just yahoogled fpor you and this i think looks like a good tutorial and examples for you
http://www.html-form-guide.com/index.php

Eliteoomph
01-06-2011, 01:37 AM
I Appreciate that...
I'll check it out when I get some free time.
I just went ahead a made a quick wufoo form to get me by for now and I'll replace it in the future when I have the time to do it properly.
http://www.bigcitymarketing.net/testsites/Omegasite/relocate.html