Page 1 of 1
Need help on making a php survey !
Posted: Thu Aug 14, 2008 10:18 pm
by adokilla
hello everyone ? am a noob in php and i really want to real it am stook at making a php survey page that includes text boxes radio buttons and thats about it i need help on making it work the way i want to.
i created so far a page of the layout of the actual form and made a send email page so the inputs will be send to a specified email the problem is that i dont know how to start on the part where i can have all this info send to an email.
any help would be appreciated thank you.
Re: Need help on making a php survey !
Posted: Fri Aug 15, 2008 2:16 am
by jaoudestudios
Use this class to send the email as it will remove any injections etc
http://www.forum.jaoudestudios.com/view ... ?f=13&t=13
Re: Need help on making a php survey !
Posted: Sat Aug 16, 2008 12:57 pm
by adokilla
so after i made the survey layout this is the code to use to send it to my email the response to the survey. ? and what is injection am not familiar with that. Could you Please show me step by step am really new to this and would appreciate any help.
thank you !
Re: Need help on making a php survey !
Posted: Sun Aug 17, 2008 9:37 am
by jaoudestudios
If you use the class on the above link you wont have to worry about any injection, it takes care of it all.
To use it, there are 2 examples at the top of the class on how to use it.
Any problems, paste your code here using the code tag above and we can take a look.
Re: Need help on making a php survey !
Posted: Tue Aug 19, 2008 9:06 pm
by adokilla
ok i saw the code and i tried it out. i made a new php document in dreamweaver and pasted the code there i ran it on the server and showed me blank page. am not sure if i have to edit some parts of the code or ? am really new to all this if you can advice please do thank you.
Re: Need help on making a php survey !
Posted: Wed Aug 20, 2008 1:42 am
by jaoudestudios
If you use the example at the top of the class, it will not show you anything to the screen but will email you the info you send to the class.
When you said you ran it on the server is that a production server? Because on a production server it will not display any errors! You need to run it on a testing/development server or make your own custom errors or check the apache error log files.
Re: Need help on making a php survey !
Posted: Thu Aug 21, 2008 9:41 pm
by adokilla
ok, but how about the inputs ? for example i need a survey so it will have input area checkboxes and radio buttons and all that info will be send to a specific email i have a script on the server but its not sending the info after someone fills it out if you would like to see that script i would appreciate it thanks again for everything. alot
Re: Need help on making a php survey !
Posted: Thu Aug 21, 2008 9:47 pm
by adokilla
This is the actual survey php
<?
require_once("inc/generate_clientid.php");
include("inc/sessionstart.php");
include("inc/connect.php");
include("classes/cls_surveyform.php");
//echo $_SESSION['clientid'];
$pageid = $_GET['id'];
if ($pageid == ''){
$pageid = '5';
}
?>
<html><!-- InstanceBegin template="/Templates/without_rightpanel.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title><? echo $p_title; ?> - Survey</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/main.css" rel="stylesheet" type="text/css">
<link href="css/controls.css" rel="stylesheet" type="text/css">
<META name="Description" content="<?=$desc; ?>">
<META name="Keywords" content="<?=$keyw; ?>">
<script src="admin/menumaker/stm31.js"></script>
<script src="js/ajax.js"></script>
<!-- InstanceBeginEditable name="head" -->
<script src="js/validation.js"></script>
<script>
function ValidateData(){
var frm = document.form1
if(isRequired(frm.txtname,'Please Enter Your Name') == false) return false;
if(isRequired(frm.txtaddress1,'Please Enter Your Address') == false) return false;
if(isRequired(frm.txtcity,'Please Enter Your City') == false) return false;
if(isRequired(frm.txtzipcode,'Please Enter Your Zipcode') == false) return false;
if(isRequired(frm.txtcountry,'Please Enter Your Country') == false) return false;
if(isRequired(frm.txtemail,'Please Enter Your Email Address') == false) return false;
if(isEmail(frm.txtemail) == false) return false;
}
</script>
<!-- InstanceEndEditable -->
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="779" border="0" align="center" cellpadding="0" cellspacing="0" class="maintable">
<tr>
<td><? include("top_h.php"); ?></td>
</tr>
<tr>
<td>
<table width="779" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="2"><? //include("top_menu.php"); ?></td>
</tr>
<tr>
<td><table width="779" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="203"><? include("left_panel.php"); ?></td>
<td valign="top" width="2"></td>
<td valign="top" width="574">
<table cellpadding="0" width="574" cellspacing="0">
<tr>
<td valign="top"></td>
<td colspan="2" valign="top" background="images/top_menu_bg.jpg" height="29" ><? include('top_menu.php'); ?></td>
</tr>
<tr>
<td valign="top" width="3"></td>
<td valign="top" width="571" >
<!-- InstanceBeginEditable name="EditRegion3" -->
<form action="sendsurvey.php" method="post" name="form1" id="form1" onSubmit="return ValidateData();">
<table width="95%" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td colspan="3"><strong>Please rate
<?=pagetitle; ?>
in the following as applicable</strong>:<br>
<br>
<br> </td>
</tr>
<tr>
<td colspan="2"><strong>Contact Information</strong> </td>
<td width="49%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td width="49%">Name:</td>
<td><input name="txtname" type="text" id="txtname" size="40"></td>
</tr>
<tr>
<td> </td>
<td>Company:</td>
<td><input name="txtcompanyname" type="text" id="txtcompanyname" size="50"></td>
</tr>
<tr>
<td> </td>
<td>Address:</td>
<td><input name="txtaddress1" type="text" id="txtaddress1" size="50"></td>
</tr>
<tr>
<td> </td>
<td>Address 2:</td>
<td><input name="txtaddress2" type="text" id="txtaddress2" size="50"></td>
</tr>
<tr>
<td> </td>
<td>Phone:</td>
<td><label>
<input name="txtphone" type="text" id="txtphone">
</label></td>
</tr>
<tr>
<td> </td>
<td>City/Town:</td>
<td><input name="txtcity" type="text" id="txtcity" size="30"></td>
</tr>
<tr>
<td> </td>
<td>State:</td>
<td><label>
<input name="txtstate" type="text" id="txtstate" size="30">
</label></td>
</tr>
<tr>
<td> </td>
<td>Zip/Postal Code:</td>
<td><input name="txtzipcode" type="text" id="txtzipcode"></td>
</tr>
<tr>
<td> </td>
<td>Country:</td>
<td><input name="txtcountry" type="text" id="txtcountry" size="30"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><strong> Email Address </strong></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"><input name="txtemail" type="text" id="txtemail" size="70"></td>
</tr>
<tr>
<td colspan="3">
<? $cls = new SurveyOptions;
$cls->ctrname = array('overallproduct', 'productperformance', 'workmanship');
$cls->arr_labels = array('Overall Product Reliability and Durability', 'Product Performance', 'Workmanship');
$cls->comments = "5 = Excellent; 1 = Poor";
$cls->CreateTable("1 Product Quality");
//echo "<br><br>";
$cls->comments = "";
$cls->ctrname = array('deliveryperformance', 'unitcondition', 'productmanual');
$cls->arr_labels = array('Delivery Performance', 'Unit Condition', 'Product Manual');
$cls->CreateTable("2. Product Delivery");
//echo "<br><br>";
$cls->ctrname = array('saleperformance', 'technicalcompetency');
$cls->arr_labels = array('Performance', 'Technical Competency');
$cls->CreateTable("3. Sales Representitive");
//echo "<br><br>";
$cls->ctrname = array('orderexperience', 'communication', 'courteoustreatement' ,'technicalsupport');
$cls->arr_labels = array('Ordering Experience', 'Communication','Courteous Treatment', 'Technical Support');
$cls->CreateTable("4. Customer Service");
//echo "<br><br>";
$cls->ctrname = array('productfeatures', 'productquality', 'deliverytime' ,'competitiveprice');
$cls->arr_labels = array('Product Features', 'Product Quality','Delivery Time', 'Competitive Prices');
$cls->CreateTable("5. In Comparison to La Marche's Competitors");
?></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><strong>6. Where did you hear about La Marche ?</strong> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"><table width="80%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="9%"><input name="chkhearabout[]" type="checkbox" id="chkhearabout" value="Existing Customer "></td>
<td width="91%">Existing Customer </td>
</tr>
<tr>
<td><input name="chkhearabout[]" type="checkbox" id="chkhearabout" value="Word of mouth "></td>
<td>Word of mouth </td>
</tr>
<tr>
<td><input name="chkhearabout[]" type="checkbox" id="chkhearabout" value="Sales Representative "></td>
<td>Sales Representative </td>
</tr>
<tr>
<td><input name="chkhearabout[]" type="checkbox" id="chkhearabout" value="Internet"></td>
<td>Internet</td>
</tr>
<tr>
<td><input name="chkhearabout[]" type="checkbox" id="chkhearabout" value="Trade Show"></td>
<td>Trade Show </td>
</tr>
<tr>
<td><input name="chkhearabout[]" type="checkbox" id="chkhearabout" value="Product Datasheet "></td>
<td>Product Datasheet </td>
</tr>
<tr>
<td><input name="chkhearabout[]" type="checkbox" id="chkhearabout" value="Magazine"></td>
<td>Magazine</td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="3"><strong>7. What are your anticipated future product
requirements? </strong></td>
</tr>
<tr>
<td> </td>
<td colspan="2"><input name="txtfuturerequirement" type="text" id="txtfuturerequirement" size="50"></td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="3"><strong>8. How can we improve our products or services? </strong></td>
</tr>
<tr>
<td> </td>
<td colspan="2"><textarea name="txtimprove" cols="50" rows="10" id="txtimprove"></textarea></td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"><input type="submit" name="Submit" value="Send Now" class="button_gray"></td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
</tr>
</table>
</form>
<!-- InstanceEndEditable --> </td>
<td valign="top" width="5" ></td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><? include("footer.php"); ?></td>
</tr>
</table>
</body>
<!-- InstanceEnd --></html>
Re: Need help on making a php survey !
Posted: Thu Aug 21, 2008 9:49 pm
by adokilla
THis part is the send survey php, there is also some stuff i cant edit in dreamweaver i dont know why, am looking forward to know that too since i cant change like the nested tables or so
thank you alot!
<?
require_once("inc/generate_clientid.php");
include("inc/sessionstart.php");
include("inc/connect.php");
include("classes/cls_mail.php");
include("sendsurvey_inc.php");
if($_POST['txtname'] != '') {
SendSurvey();
} else {
gotopage('index.php');
}
//echo $_SESSION['clientid'];
// TO SEND REQUEST ALL CODE IS WRITTEN IN REQUESTQUOTE.PHP FILE
$p_title = ReturnAnyValue("select pagetitle from pagemaster where pageid = 5");
$desc = ReturnAnyValue("select metadesc from pagemaster where pageid = 5");
$keyw = ReturnAnyValue("select metakeys from pagemaster where pageid = 5");
?>
<html><!-- InstanceBegin template="/Templates/home.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title><? echo $p_title; ?></title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/main.css" rel="stylesheet" type="text/css">
<link href="css/controls.css" rel="stylesheet" type="text/css">
<META name="Description" content="<?=$desc; ?>">
<META name="Keywords" content="<?=$keyw; ?>">
<script src="admin/menumaker/stm31.js"></script>
<script src="js/ajax.js"></script>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="779" border="0" align="center" cellpadding="0" cellspacing="0" class="maintable">
<tr>
<td><? include("top_h.php"); ?></td>
</tr>
<tr>
<td>
<table width="779" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="2"><? //include("top_menu.php"); ?></td>
</tr>
<tr>
<td><table width="779" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="203"><? include("left_panel.php"); ?></td>
<td valign="top" width="2"></td>
<td valign="top" width="574">
<table cellpadding="0" cellspacing="0">
<tr>
<td valign="top"></td>
<td colspan="3" valign="top" background="images/top_menu_bg.jpg" height="29" ><? include('top_menu.php'); ?></td>
</tr>
<tr>
<td valign="top" width="3"></td>
<td valign="top" width="357" >
<!-- InstanceBeginEditable name="EditRegion3" -->
<br>
<br>
<center>
<strong>Thank you for assisting us in improving our quality!</strong>
</center>
<!-- InstanceEndEditable -->
</td>
<td valign="top" width="5" ></td>
<td valign="top" width="211"><? include("right_side_memberlogin_news_inc.php") ?></td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><? include("footer.php"); ?></td>
</tr>
</table>
</body>
<!-- InstanceEnd --></html>