Guru3D.com Forums

Go Back   Guru3D.com Forums > General > Programming/Html
Programming/Html C++,Visual Basic,HTML,Flash,OpenGL,Modelling,Java.


Reply
 
Thread Tools Display Modes
Help making a Q&A form?
Old
  (#1)
sava700
Ancient Guru
 
sava700's Avatar
 
Videocard: eVGA 570GTX SC 310.61's
Processor: IntelQuad Q9300
Mainboard: ASUS P5K-E LGA 775
Memory: OCZ ReaperHPC 8GB PC2-640
Soundcard: onboard
PSU: PC Power & Cooling 760W
Default Help making a Q&A form? - 05-24-2012, 15:27 | posts: 4,863 | Location: In a game world

I'm looking for someone that knows how to setup a basic HTML layout that will use a php file or not in which there will be 10 Questions. The boxes for text will be of enough to put in a few sentences as needed to place answers in and once these answers are all filled in click Submit and it sends the questions along side the results to an email of my choice.

I've set up a few feedback forms from templates I've found online but editing them so far has drove me nuts as the form doesn't seem to be sending. If you know how to do this please PM me...you can just put in temp questions and a temp email I'll edit them later.
I only need a total of 10 Question slots

This is basically going to be used on a site that has full up to date php versions etc etc..so don't worry about that.
Thanks

Last edited by sava700; 05-24-2012 at 15:29.
   
Reply With Quote
 
Old
  (#2)
Tat3
Ancient Guru
 
Tat3's Avatar
 
Videocard: Gigabyte GTX480 w/ 244T
Processor: i7 920 @ 4,4GHz | Water
Mainboard: DFI UT X58 T3eH8
Memory: 3*2Gb 8-8-8-20 @ 1680MHz
Soundcard: UA-55 -> 2*Genelec 8030B
PSU: Defo not modular (TX950W)
Default 05-24-2012, 15:53 | posts: 11,194 | Location: Finland

Check out this site, if you have not already.
http://www.w3schools.com/
   
Reply With Quote
Old
  (#3)
sava700
Ancient Guru
 
sava700's Avatar
 
Videocard: eVGA 570GTX SC 310.61's
Processor: IntelQuad Q9300
Mainboard: ASUS P5K-E LGA 775
Memory: OCZ ReaperHPC 8GB PC2-640
Soundcard: onboard
PSU: PC Power & Cooling 760W
Default 05-24-2012, 16:14 | posts: 4,863 | Location: In a game world

Quote:
Originally Posted by Tat3 View Post
Check out this site, if you have not already.
http://www.w3schools.com/
yeah, no not what I had in mind. I mean I can make a site that's not an issue. I'm having trouble with this form is the problem. I've made the form and the php file to process or email it to me but its not sending so I figured either 1) someone knew how to quickly make one or had one I could just edit to work for my needs or knew of a place with a free example of both files I could also edit to work for my needs.

I don't need to learn it I'm just having trouble with it and I'm beyond frustrated so I've come to my fellow guru's for a quick solution.
   
Reply With Quote
Old
  (#4)
Anarion
Ancient Guru
 
Anarion's Avatar
 
Videocard: ASUS GeForce GTX 780 DC2
Processor: Intel Core i7 3770K
Mainboard: ASUS P8Z77-V
Memory: G.SKILL RipjawsX 16 GB
Soundcard: Sound Blaster Zx + HD 595
PSU: SF Golden Green Pro 600W
Default 05-24-2012, 18:26 | posts: 10,519 | Location: Finland

HTML Code:
<form action="controller.php" method="post">
<p>First question?</p>
<textarea name="text1"></textarea>
<p>Second question?</p>
<textarea name="text2"></textarea>
...
<p>Tenth question?</p>
<textarea name="text10"></textarea>
<button type="submit" name="sendbtn" >Send</button>
</form>
   
Reply With Quote
 
Old
  (#5)
Tat3
Ancient Guru
 
Tat3's Avatar
 
Videocard: Gigabyte GTX480 w/ 244T
Processor: i7 920 @ 4,4GHz | Water
Mainboard: DFI UT X58 T3eH8
Memory: 3*2Gb 8-8-8-20 @ 1680MHz
Soundcard: UA-55 -> 2*Genelec 8030B
PSU: Defo not modular (TX950W)
Default 05-24-2012, 18:32 | posts: 11,194 | Location: Finland

Post the problematic code here from both files so we can have a look.
   
Reply With Quote
Old
  (#6)
sava700
Ancient Guru
 
sava700's Avatar
 
Videocard: eVGA 570GTX SC 310.61's
Processor: IntelQuad Q9300
Mainboard: ASUS P5K-E LGA 775
Memory: OCZ ReaperHPC 8GB PC2-640
Soundcard: onboard
PSU: PC Power & Cooling 760W
Default 05-24-2012, 19:12 | posts: 4,863 | Location: In a game world

Quote:
Originally Posted by Tat3 View Post
Post the problematic code here from both files so we can have a look.
sure here ya go:

This is the html file named - Tier2Application.html

Code:
<form name="htmlform" method="post" action="html_form_send.php">
<table width="450px">
</tr>
<tr>
 <td valign="top">
  <label for="age">What is your age? </label>
 </td>
 <td valign="top">
  <input  type="text" name="age" maxlength="50" size="30">
 </td>
</tr>
 
<tr>
 <td valign="top"">
  <label for="Time_Zone">What Time Zone/Country do you live in? </label>
 </td>
 <td valign="top">
  <input  type="text" name="Time_Zone" maxlength="50" size="30">
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="Extra_abilities">What other servers do you currently have extra abilities with ie: VIP, Donator, Admin etc etc? </label>
 </td>
 <td valign="top">
  <textarea  type="text" name="Extra_abilities" maxlength="1000" cols="25" rows="6"></textarea>
 </td>
 
</tr>
<tr>
 <td valign="top">
  <label for="position">Tell us why you think you should hold this position.</label>
 </td>
 <td valign="top">
  <textarea  type="text" name="position" maxlength="1000" cols="30" rows="6"></textarea>
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="dedicate">How much time do you dedicate to our Servers in a week?</label>
 </td>
 <td valign="top">
  <input  name="dedicate" maxlength="70" size="30">
 </td>
 <tr>
 <td valign="top">
  <label for="improve">Tell us how you could help us to improve our community and servers.</label>
 </td>
 <td valign="top">
  <textarea  type="text" name="improve" maxlength="1000" cols="30" rows="6"></textarea>
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="Opinion">What do you think of the servers at this time?</label>
 </td>
 <td valign="top">
  <textarea  type="text" name="Opinion" maxlength="1000" cols="30" rows="6"></textarea>
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="Duration">How long have you been a part of this function?</label>
 </td>
 <td valign="top">
  <textarea  type="text" name="Duration" maxlength="1000" cols="30" rows="6"></textarea>
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="Rep_Thread">Do you have a site? If so please provide URL.</label>
 </td>
 <td valign="top">
  <textarea  type="text" name="Rep_Thread" maxlength="1000" cols="30" rows="6"></textarea>
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="populate">What suggestions would you give to enhance the servers to help populate them more?</label>
 </td>
 <td valign="top">
  <textarea  type="text" name="populate" maxlength="1000" cols="30" rows="6"></textarea>
 </td>
</tr>
 
</tr>
<tr>
 <td colspan="2" style="text-align:center">
  <input type="submit" value="Submit">   ( <a href="http://www.none.com">none</a> )
 </td>
</tr>
</table>
</form>
here is the php file named html_form_send.php

Code:
<?php
if(isset($_POST['email'])) {
     
    // CHANGE THE TWO LINES BELOW
    $webmaster_email = "Mysite@mysite.com";
     
    $email_subject = "Tier2 Application";
     
     
    function died($error) {
        // your error code can go here
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
        die();
    }
     
    // validation expected data exists
    if(!isset($_POST['age']) ||
        !isset($_POST['Time_Zone']) ||
        !isset($_POST['Extra_abilities']) ||
        !isset($_POST['position']) ||
        !isset($_POST['dedicate']) ||
		!isset($_POST['improve']) ||
		!isset($_POST['Opinion']) ||
		!isset($_POST['Duration']) ||
		!isset($_POST['Rep_Thread']) ||
		!isset($_POST['populate'])) {
        died('We are sorry, but there appears to be a problem with the form you submitted.');      
    }
     
    $age = $_POST['age']; // required
    $Time_Zone = $_POST['Time_Zone']; // required
    $Extra_abilities = $_POST['Extra_abilities']; // required
    $position = $_POST['position']; // required
    $dedicate = $_POST['dedicate']; // required
	$improve = $_POST['improve']; // required
	$Opinion = $_POST['Opinion']; // required
	$Duration = $_POST['Duration']; // required
	$Rep_Thread = $_POST['Rep_Thread']; // required
	$populate = $_POST['populate']; // required
     
    $error_message = "";
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';

  }
  if(strlen($error_message) > 0) {
    died($error_message);
  }
    $email_message = "Form details below.\n\n";
     
    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }
     
    $email_message .= "First Name: ".clean_string($first_name)."\n";
    $email_message .= "Last Name: ".clean_string($Time_Zone)."\n";
    $email_message .= "Email: ".clean_string($email_from)."\n";
    $email_message .= "position: ".clean_string($position)."\n";
    $email_message .= "dedicate: ".clean_string($dedicate)."\n";
	$email_message .= "improve: ".clean_string($improve)."\n";
    $email_message .= "Opinion: ".clean_string($Opinion)."\n";
	$email_message .= "Duration: ".clean_string($Duration)."\n";
	$email_message .= "Rep_Thread: ".clean_string($Rep_Thread)."\n";
	$email_message .= "populate: ".clean_string($populate)."\n";
     
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers); 
?>
 
<!-- place your own success html below -->
 
Thank you for the application. We will be in touch with you very soon.
 
<?php

die();
?>
   
Reply With Quote
Old
  (#7)
sava700
Ancient Guru
 
sava700's Avatar
 
Videocard: eVGA 570GTX SC 310.61's
Processor: IntelQuad Q9300
Mainboard: ASUS P5K-E LGA 775
Memory: OCZ ReaperHPC 8GB PC2-640
Soundcard: onboard
PSU: PC Power & Cooling 760W
Default 05-25-2012, 15:11 | posts: 4,863 | Location: In a game world

anyone figure out the error here?
   
Reply With Quote
Old
  (#8)
sava700
Ancient Guru
 
sava700's Avatar
 
Videocard: eVGA 570GTX SC 310.61's
Processor: IntelQuad Q9300
Mainboard: ASUS P5K-E LGA 775
Memory: OCZ ReaperHPC 8GB PC2-640
Soundcard: onboard
PSU: PC Power & Cooling 760W
Default 05-25-2012, 19:54 | posts: 4,863 | Location: In a game world

Well this got moved I hope someone here sees it
   
Reply With Quote
Old
  (#9)
Nato.dbnz
Ancient Guru
 
Nato.dbnz's Avatar
 
Videocard: 5870 Crossfire
Processor: 2500k 4.5GHz
Mainboard: ASUS P8P67 Pro
Memory: 8Gb Dominator 1600
Soundcard: Xonar STX + HD598
PSU: Silverstone Strider 1000W
Default 06-15-2012, 04:30 | posts: 3,258 | Location: Auckland NZ

There were errors all over the place but your main one is that your first line of php is checking POST for a variable that doesn't exist. You also set up the variable for $webmaster_email and then use the variable $email_to to try and send. These files now work.

Code:
<?php
if(isset($_POST['age'])) {
     
    // CHANGE THE TWO LINES BELOW
    $email_to = "";
     
    $email_subject = "Tier2 Application";
     
     
    function died($error) {
        // your error code can go here
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
        die();
    }
     
    // validation expected data exists
    if(!isset($_POST['age']) ||
        !isset($_POST['Time_Zone']) ||
        !isset($_POST['Extra_abilities']) ||
        !isset($_POST['position']) ||
        !isset($_POST['dedicate']) ||
		!isset($_POST['improve']) ||
		!isset($_POST['Opinion']) ||
		!isset($_POST['Duration']) ||
		!isset($_POST['Rep_Thread']) ||
		!isset($_POST['populate'])) {
        died('We are sorry, but there appears to be a problem with the form you submitted.');      
    }
     
    $age = $_POST['age']; // required
    $Time_Zone = $_POST['Time_Zone']; // required
    $Extra_abilities = $_POST['Extra_abilities']; // required
    $position = $_POST['position']; // required
    $dedicate = $_POST['dedicate']; // required
	$improve = $_POST['improve']; // required
	$Opinion = $_POST['Opinion']; // required
	$Duration = $_POST['Duration']; // required
	$Rep_Thread = $_POST['Rep_Thread']; // required
	$populate = $_POST['populate']; // required
     
    $error_message = "";
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';

  }
  if(strlen($error_message) > 0) {
    died($error_message);
  }
    $email_message = "Form details below.\n\n";
     
    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }
     
    $email_message .= "First Name: ".clean_string($first_name)."\n";
    $email_message .= "Last Name: ".clean_string($Time_Zone)."\n";
    $email_message .= "Email: ".clean_string($email_from)."\n";
    $email_message .= "position: ".clean_string($position)."\n";
    $email_message .= "dedicate: ".clean_string($dedicate)."\n";
	$email_message .= "improve: ".clean_string($improve)."\n";
    $email_message .= "Opinion: ".clean_string($Opinion)."\n";
	$email_message .= "Duration: ".clean_string($Duration)."\n";
	$email_message .= "Rep_Thread: ".clean_string($Rep_Thread)."\n";
	$email_message .= "populate: ".clean_string($populate)."\n";
     
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers); 
?>
 
<!-- place your own success html below -->
 
Thank you for the application. We will be in touch with you very soon.
 
<?php

die();
?>
Code:
<html>
<form name="htmlform" method="post" action="send_form.php">
<table width="450px">
<tr>
 <td valign="top">
  <label for="age">What is your age? </label>
 </td>
 <td valign="top">
  <input  type="text" name="age" maxlength="50" size="30">
 </td>
</tr>
 
<tr>
 <td valign="top">
  <label for="Time_Zone">What Time Zone/Country do you live in? </label>
 </td>
 <td valign="top">
  <input  type="text" name="Time_Zone" maxlength="50" size="30">
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="Extra_abilities">What other servers do you currently have extra abilities with ie: VIP, Donator, Admin etc etc? </label>
 </td>
 <td valign="top">
  <textarea  type="text" name="Extra_abilities" maxlength="1000" cols="25" rows="6"></textarea>
 </td>
 
</tr>
<tr>
 <td valign="top">
  <label for="position">Tell us why you think you should hold this position.</label>
 </td>
 <td valign="top">
  <textarea  type="text" name="position" maxlength="1000" cols="30" rows="6"></textarea>
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="dedicate">How much time do you dedicate to our Servers in a week?</label>
 </td>
 <td valign="top">
  <input  name="dedicate" maxlength="70" size="30">
 </td>
 <tr>
 <td valign="top">
  <label for="improve">Tell us how you could help us to improve our community and servers.</label>
 </td>
 <td valign="top">
  <textarea  type="text" name="improve" maxlength="1000" cols="30" rows="6"></textarea>
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="Opinion">What do you think of the servers at this time?</label>
 </td>
 <td valign="top">
  <textarea  type="text" name="Opinion" maxlength="1000" cols="30" rows="6"></textarea>
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="Duration">How long have you been a part of this function?</label>
 </td>
 <td valign="top">
  <textarea  type="text" name="Duration" maxlength="1000" cols="30" rows="6"></textarea>
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="Rep_Thread">Do you have a site? If so please provide URL.</label>
 </td>
 <td valign="top">
  <textarea  type="text" name="Rep_Thread" maxlength="1000" cols="30" rows="6"></textarea>
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="populate">What suggestions would you give to enhance the servers to help populate them more?</label>
 </td>
 <td valign="top">
  <textarea  type="text" name="populate" maxlength="1000" cols="30" rows="6"></textarea>
 </td>
</tr>
 
</tr>
<tr>
 <td colspan="2" style="text-align:center">
  <input type="submit" value="submit">
 </td>
</tr>
</table>
</form>
</html>
The php now checks for the POST variable age but you can change that to any variable that exists on the form.
   
Reply With Quote
Old
  (#10)
Nato.dbnz
Ancient Guru
 
Nato.dbnz's Avatar
 
Videocard: 5870 Crossfire
Processor: 2500k 4.5GHz
Mainboard: ASUS P8P67 Pro
Memory: 8Gb Dominator 1600
Soundcard: Xonar STX + HD598
PSU: Silverstone Strider 1000W
Default 06-15-2012, 04:36 | posts: 3,258 | Location: Auckland NZ

Also this bit:

Code:
 $email_message .= "First Name: ".clean_string($first_name)."\n";
    $email_message .= "Last Name: ".clean_string($Time_Zone)."\n";
    $email_message .= "Email: ".clean_string($email_from)."\n";
    $email_message .= "position: ".clean_string($position)."\n";
    $email_message .= "dedicate: ".clean_string($dedicate)."\n";
	$email_message .= "improve: ".clean_string($improve)."\n";
    $email_message .= "Opinion: ".clean_string($Opinion)."\n";
	$email_message .= "Duration: ".clean_string($Duration)."\n";
	$email_message .= "Rep_Thread: ".clean_string($Rep_Thread)."\n";
	$email_message .= "populate: ".clean_string($populate)."\n";
Needs to be updated to reflect the variables in your form or else the info will come through mislabelled on the email. So you need to put age, timezone, extra abilities etc in here.
   
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com
Copyright (c) 1995-2014, All Rights Reserved. The Guru of 3D, the Hardware Guru, and 3D Guru are trademarks owned by Hilbert Hagedoorn.