File name as variable PHP

I have an existing form that I am modifying for another use. I want to be able to name the file to lastname.firstname.txt,  eg: Lewis.Charles.txt.

My question is the code below correct for doing that.
I am rusty on my quote usage for PHP.

$filename = "apps/'$lname'.'$fname'.txt"; //File to be written to

Open in new window

LVL 1
rodneygrayAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

COBOLdinosaurCommented:
$filename = 'apps/'.$lname.$fname.'.txt'; //File to be written to

If I understand what you are asking.

Cd&
0
Ray PaseurCommented:
Quotes in PHP:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_12241-Quotation-Marks-in-PHP.html

<?php // RAY_temp_rodneygray.php
ini_set('display_errors', TRUE);
error_reporting(E_ALL);

$lname = 'Lewis';
$fname = 'Charles';
$filename = "apps/$lname.$fname.txt";

// OUTPUTS apps/Lewis.Charles.txt
echo $filename;

Open in new window

Don't forget that some file systems are case-sensitive!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dave BaldwinFixer of ProblemsCommented:
And file names with spaces in them are often a problem.  You also need to filter out special characters in that operating system like '\', '/', and others.  Because someone will try to use them.  Like "John/Becky Morgan".
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

rodneygrayAuthor Commented:
Below is the complete code.

<?php 

/* |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||| Variables ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/

$today = date("DATE_RFC2822"); // sets $today to today's date from client device

	$fname = $_POST['fname'];
	$lname = $_POST['lname'];
	$phone = $_POST['phone'];
	$addr = $_POST['addr'];
	$city = $_POST['city'];
	$state = $_POST['state'];
	$zip = $_POST['zip'];
	$email = $_POST['email'];
	$besttime = $_POST['besttime'];
	$contactmethod = $_POST['contactmethod'];
	$dob = $_POST['dob'];
	$howhear = $_POST['howhear'];
	if(isset($_POST['cardiosurgery']))  { $cardiosurgery = "YES"; }
	if(isset($_POST['schdocvisits']))  { $schdocvisits = "YES"; }
	if(isset($_POST['homecare']))  { $homecare = "YES"; }
	if(isset($_POST['ekgtesting']))  { $ekgtesting = "YES"; } 
	if(isset($_POST['other']))  { $other = "YES"; }
	$othermsg = $_POST['othermsg'];

/* ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||| Validation ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/

 switch (@$_GET['do'])

  {

    case "send":
      if (!preg_match("/\S+/",$fname))
      {
        unset($_GET['do']);
        $message = "First Name required. Please try again.";
         break;
      }
      if (!preg_match("/\S+/",$lname))
      {
        unset($_GET['do']);
        $message = "Last Name required. Please try again.";
         break;
      }
      if (!preg_match("/^\S+@[A-Za-z0-9_.-]+\.[A-Za-z]{2,6}$/",$email))
      {
        unset($_GET['do']);
        $message = "Proper Email Address format: example@website.net Please try again.";
        break;
      }
      if (!preg_match("/^[0-9 #\-\*\.\(\)]+$/",$phone))
      {
        unset($_GET['do']);
        $message = "Phone Number required. No letters, please.";
         break;
      }

/* |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||| Set message to null if no error ||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/

       $message = '';
       unset($_GET['do']);
     break;
 default: break;
   }

/* |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||| Write Variables to File ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/


	if(isset($_POST['submit'])){

	if ($message == "") {

	$filename = "files/$lname.$fname.txt";

	$fhandle = fopen($filename, 'w'); // variable to hold file name

	fwrite($fhandle,'Date: '.$today."\n"); //Writes $today to textfile

	fwrite($fhandle,'Best Time to Call: '.$besttime."\n"); //Writes $besttime to textfile

	fwrite($fhandle,'ContactMethod: '.$contactmethod."\n"); //Writes $contactmethod to textfile

	fwrite($fhandle,'First Name: '.$fname."\n"); //Writes $today to textfile

	fwrite($fhandle,'Last Name:~ '.$lname."\n"); //Writes $today to textfile

	fwrite($fhandle,'Phone Number: '.$phone."\n"); //Writes $today to textfile

	fwrite($fhandle,'Address: '.$addr."\n"); //Writes $today to textfile

	fwrite($fhandle,'City: '.$city."\n"); //Writes $today to textfile

	fwrite($fhandle,'State: '.$state."\n"); //Writes $today to textfile

	fwrite($fhandle,'Zip: '.$zip."\n"); //Writes $today to textfile

	fwrite($fhandle,'Email: '.$email."\n"); //Writes $today to textfile

	fwrite($fhandle,'Date of Birth: '.$dob."\n"); //Writes $today to textfile

	fwrite($fhandle,'Cardiovascular Surgery: '.$nursesvc."\n"); //Writes $today to textfile

	fwrite($fhandle,'Schedule Dr. Visits: '.$pcare."\n"); //Writes $today to textfile

	fwrite($fhandle,'Home Care: '.$homecare."\n"); //Writes $today to textfile

	fwrite($fhandle,'EKG Testing: '.$ekgtesting."\n"); //Writes $today to textfile

	fwrite($fhandle,'Other_Message~ '.$othermsg."\n"); //Writes $today to textfile

	fwrite($fhandle,'How did you hear about us: '.$howhear."\n"); //Writes $today to textfile

	fclose($fhandle);


/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||| phpmailer sends file as attachment |||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/



	require_once('class.phpmailer.php'); //File must be located in same directory
	
	$mail             = new PHPMailer(); // defaults to using php "mail()"
	$body             = file_get_contents('contents.html'); // File with message for email
	$body             = eregi_replace("[\]",'',$body);
	$mail->SetFrom('questioner@douglasmedical.com', 'Questioner Answers'); // Sent from Email Address/Name
	$mail->AddReplyTo("questioner@douglasmedical.com","Questioner Answers"); // Reply to email address
	$address = "questioner@douglasmedical.com"; // Email of Recipient
	$mail->AddAddress($address, "Questioner Answers"); // Name of Recipient
	$mail->Subject    = "DMS Patient Questioner from: For $plname, $pfname"; // Subject Line of Email
	$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
	$mail->MsgHTML($body);
	$mail->AddAttachment("apps/referral.txt");      // attachment

	if(!$mail->Send()) {

	  echo "Mailer Error: " . $mail->ErrorInfo;

	} else {

	  echo '<META HTTP-EQUIV="refresh" content="0;URL=thank_you.htm">'; // Redirect to thank you page

	}	}	}

?>

<!-- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||||||| Start HTML CODE ||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>Douglas Medical Specialists | Questioner Form</title>

<link rel="stylesheet" href="questioner.css" type="text/css" >
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<!-- JS to limit number of characters in text fields -->
<script language="javascript" type="text/javascript">
function limitText(limitField, limitCount, limitNum) {

	if (limitField.value.length > limitNum) {

		limitField.value = limitField.value.substring(0, limitNum);

	} else {

		limitCount.value = limitNum - limitField.value.length;

	}

}

</script>
<script type="text/javascript">
/***********************************************
* Disable "Enter" key in Form script- By Nurul Fadilah(nurul@REMOVETHISvolmedia.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
function handleEnter (field, event) {
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			var i;
			for (i = 0; i < field.form.elements.length; i++)
				if (field == field.form.elements[i])
					break;
			i = (i + 1) % field.form.elements.length;
			field.form.elements[i].focus();
			return false;
		} 
		else
		return true;
	}      
</script>
</head>
<body>
<center>
<form action="index.php?do=send" method="POST">
<p><a href="index.html">
<img alt="" src="images/doctors.png"></a></p>
	<h1>Patient Referrals</h1>
<p>Please fill in the Referral Form Below.</p>
<p><font color="red">*</font> Required Fields</p> <span style="color:red;">
<?php
	if ($message)
	echo "$message"; 
?>
</span>
   <table border="1" width="500">
	<TR bgcolor="#B2C6DE">
	<TD align="center" colSpan=6>Patient Information</TD>
	</TR>
   <tr><td width="150px">
   <font color="red">*</font> First Name: </td><td><input type="text" name="fname" size="20" value="<?php echo @$fname ?>"

   						onkeypress="return handleEnter(this, event);"

   						onKeyDown="limitText(this.form.fname,this.form.countdown9,45);" 

						onKeyUp="limitText(this.form.fname,this.form.countdown9,45);">

   </td></tr>
   <tr><td>
   <font color="red">*</font> Last Name: </td><td><input type="text" name="lname" size="20" value="<?php echo @$lname ?>"

   						onkeypress="return handleEnter(this, event);"
   						onKeyDown="limitText(this.form.lname,this.form.countdown10,45);" 
						onKeyUp="limitText(this.form.lname,this.form.countdown10,45);">
   </td></tr>
   <tr><td>
   Phone Number: </td><td><input type="text" name="phone" size="20" value="<?php echo @$phone ?>"
   						onkeypress="return handleEnter(this, event);"
   						onKeyDown="limitText(this.form.phone,this.form.countdown11,12);" 
						onKeyUp="limitText(this.form.phone,this.form.countdown11,12);">
   </td></tr>
   <tr><td>
   Address: </td><td><input type="text" name="addr" size="20" value="<?php echo @$addr ?>"
   						onkeypress="return handleEnter(this, event);"
   						onKeyDown="limitText(this.form.addr,this.form.countdown12,80);" 
						onKeyUp="limitText(this.form.addr,this.form.countdown12,80);">
   </td></tr>
   <tr><td>
   City: </td><td><input type="text" name="city" size="20" value="<?php echo @$city ?>"
   						onkeypress="return handleEnter(this, event);"
   						onKeyDown="limitText(this.form.city,this.form.countdown13,20);" 
						onKeyUp="limitText(this.form.city,this.form.countdown13,20);">
   </td></tr>
   <tr><td>
   State: </td><td><input type="text" name="state" size="20" value="<?php echo @$state ?>"
   						onkeypress="return handleEnter(this, event);"
   						onKeyDown="limitText(this.form.state,this.form.countdown14,2);" 
						onKeyUp="limitText(this.form.state,this.form.countdown14,2);">
   </td></tr>
   <tr><td>
   Zip: </td><td><input type="text" name="zip" size="20" value="<?php echo @$zip ?>"
   						onkeypress="return handleEnter(this, event);"
   						onKeyDown="limitText(this.form.zip,this.form.countdown15,5);" 
						onKeyUp="limitText(this.form.zip,this.form.countdown15,5);">
   </td></tr>
   <tr><td>
   Email: </td><td><input type="text" name="email" size="20" value="<?php echo @$email ?>"
   						onkeypress="return handleEnter(this, event);"
   						onKeyDown="limitText(this.form.email,this.form.countdown16,50);" 
						onKeyUp="limitText(this.form.email,this.form.countdown16,50);">
   </td></tr>
   <tr><td>

   Date of Birth: </td><td><input type="text" name="dob" size="20" value="<?php echo @$dob ?>"

   						onkeypress="return handleEnter(this, event);"

   						onKeyDown="limitText(this.form.dob,this.form.countdown17,10);" 

						onKeyUp="limitText(this.form.dob,this.form.countdown17,10);">

   </td></tr>

   </table>



   <table border="1" width="500">

	<TR bgcolor="#B2C6DE">

	<TD align="center" colSpan=6>Questioner</TD>

	</TR>

   <tr><td>
	Are you interested in the following services?<br>
   <input type="checkbox" name="cardiosurgery" value="YES"> Cardiovascular Surgery<br>
   <input type="checkbox" name="schdocvisits" value="YES"> Scheduling Regular Doctor Visits<br>
   <input type="checkbox" name="homecare" value="YES"> Home Care (Housekeeping, Laundry, Meal Prep, etc.)<br>
   <input type="checkbox" name="ekgtesting" value="YES"> EKG Testing<br>
   <input type="checkbox" name="bloodwork" value="YES"> Blood Work<br>
   <input type="checkbox" name="other" > Other - Please Specify:<br>
   
   Other Information:<br>
   <textarea rows="5" cols="40" name="othermsg" 
   						onkeypress="return handleEnter(this, event);"
   						onKeyDown="limitText(this.form.othermsg,this.form.countdown18,240);" 
						onKeyUp="limitText(this.form.othermsg,this.form.countdown18,240);"
						><?php echo @$othermsg ?></textarea>

   </td></tr>
	<tr><td>How did you hear about Douglas Medical Specialists?<br>
	 <textarea rows="5" cols="40" name="howhear" 
	 					onkeypress="return handleEnter(this, event);"
	 					onKeyDown="limitText(this.form.howhear,this.form.countdown19,240);" 
						onKeyUp="limitText(this.form.howhear,this.form.countdown19,240);"
						><?php echo @$howhear ?></textarea></td></tr>
</table>
<br>
<input type="submit" name="submit" value="Click Here to Submit" style="height: 75px; width: 400px; font-size: 24px;">
   </form>
   </center>
</body>
</html>

<!-- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||| End HTML CODE |||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -->

Open in new window

0
rodneygrayAuthor Commented:
I've made several modifications trying to get it to work again but it seems like I broke something along the way.
<?php 
// Report all PHP errors
error_reporting(-1);
/* |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||| Variables ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/

$today = date("DATE_RFC2822"); // sets $today to today's date from client device

	$fname = $_POST['fname'];
	$lname = $_POST['lname'];
	$phone = $_POST['phone'];
	$addr = $_POST['addr'];
	$city = $_POST['city'];
	$state = $_POST['state'];
	$zip = $_POST['zip'];
	$email = $_POST['email'];
	$besttime = $_POST['besttime'];
	$contactmethod = $_POST['contactmethod'];
	$dob = $_POST['dob'];
	$howhear = $_POST['howhear'];
	if(isset($_POST['cardiosurgery']))  { $cardiosurgery = "YES"; }
	if(isset($_POST['schdocvisits']))  { $schdocvisits = "YES"; }
	if(isset($_POST['homecare']))  { $homecare = "YES"; }
	if(isset($_POST['ekgtesting']))  { $ekgtesting = "YES"; } 
	if(isset($_POST['other']))  { $other = "YES"; }
	$othermsg = $_POST['othermsg'];

/* ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||| Validation ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/

 switch (@$_GET['do'])

  {

    case "send":
      if (!preg_match("/\S+/",$fname))
      {
        unset($_GET['do']);
        $message = "First Name required. Please try again.";
         break;
      }
      if (!preg_match("/\S+/",$lname))
      {
        unset($_GET['do']);
        $message = "Last Name required. Please try again.";
         break;
      }
      if (!preg_match("/^\S+@[A-Za-z0-9_.-]+\.[A-Za-z]{2,6}$/",$email))
      {
        unset($_GET['do']);
        $message = "Proper Email Address format: example@website.net Please try again.";
        break;
      }
      if (!preg_match("/^[0-9 #\-\*\.\(\)]+$/",$phone))
      {
        unset($_GET['do']);
        $message = "Phone Number required. No letters, please.";
         break;
      }

/* |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||| Set message to null if no error ||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/

       $message = '';
       unset($_GET['do']);
     break;
 default: break;
   }

/* |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||| Write Variables to File ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/


	if(isset($_POST['submit'])){

	if ($message == "") {

	$filename = 'files/questions.txt'; //File to be written to

	$fhandle = fopen($filename, 'w'); // variable to hold file name

	fwrite($fhandle,'Date- '.$today."\n"); //Writes $today to textfile

	fwrite($fhandle,'Best Time to Call- '.$besttime."\n"); //Writes $besttime to textfile

	fwrite($fhandle,'ContactMethod- '.$contactmethod."\n"); //Writes $contactmethod to textfile

	fwrite($fhandle,'First Name- '.$fname."\n"); //Writes $today to textfile

	fwrite($fhandle,'Last Name- '.$lname."\n"); //Writes $today to textfile

	fwrite($fhandle,'Phone Number- '.$phone."\n"); //Writes $today to textfile

	fwrite($fhandle,'Address- '.$addr."\n"); //Writes $today to textfile

	fwrite($fhandle,'City- '.$city."\n"); //Writes $today to textfile

	fwrite($fhandle,'State- '.$state."\n"); //Writes $today to textfile

	fwrite($fhandle,'Zip- '.$zip."\n"); //Writes $today to textfile

	fwrite($fhandle,'Email- '.$email."\n"); //Writes $today to textfile

	fwrite($fhandle,'Date of Birth- '.$dob."\n"); //Writes $today to textfile

	fwrite($fhandle,'Cardiovascular Surgery- '.$nursesvc."\n"); //Writes $today to textfile

	fwrite($fhandle,'Schedule Dr. Visits- '.$pcare."\n"); //Writes $today to textfile

	fwrite($fhandle,'Home Care- '.$homecare."\n"); //Writes $today to textfile

	fwrite($fhandle,'EKG Testin- '.$ekgtesting."\n"); //Writes $today to textfile

	fwrite($fhandle,'Other_Message~ '.$othermsg."\n"); //Writes $today to textfile

	fwrite($fhandle,'How did you hear about us: '.$howhear."\n"); //Writes $today to textfile

	fclose($fhandle);


/*||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||| phpmailer sends file as attachment |||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||*/



	require_once('class.phpmailer.php'); //File must be located in same directory
	
	$mail             = new PHPMailer(); // defaults to using php "mail()"
	$body             = file_get_contents('contents.html'); // File with message for email
	$body             = eregi_replace("[\]",'',$body);
	$mail->SetFrom('office@graycomputer.net', 'Questioner Answers'); // Sent from Email Address/Name
	$mail->AddReplyTo("office@graycomputer.net","Questioner Answers"); // Reply to email address
	$address = "office@graycomputer.net"; // Email of Recipient
	$mail->AddAddress($address, "Questioner Answers"); // Name of Recipient
	$mail->Subject    = "DMS Patient Questioner from: For $plname, $pfname"; // Subject Line of Email
	$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
	$mail->MsgHTML($body);
	$mail->AddAttachment("files/questions.txt");      // attachment

	if(!$mail->Send()) {

	  echo "Mailer Error: " . $mail->ErrorInfo;

	} else {

	  echo '<META HTTP-EQUIV="refresh" content="0;URL=thank_you.htm">'; // Redirect to thank you page

	}	}	}

?>

<!-- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||||||| Start HTML CODE ||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>Douglas Medical Specialists | Questioner Form</title>

<link rel="stylesheet" href="questioner.css" type="text/css" >
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<!-- JS to limit number of characters in text fields -->
<script language="javascript" type="text/javascript">
function limitText(limitField, limitCount, limitNum) {

	if (limitField.value.length > limitNum) {

		limitField.value = limitField.value.substring(0, limitNum);

	} else {

		limitCount.value = limitNum - limitField.value.length;

	}

}

</script>
<script type="text/javascript">
/***********************************************
* Disable "Enter" key in Form script- By Nurul Fadilah(nurul@REMOVETHISvolmedia.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
function handleEnter (field, event) {
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			var i;
			for (i = 0; i < field.form.elements.length; i++)
				if (field == field.form.elements[i])
					break;
			i = (i + 1) % field.form.elements.length;
			field.form.elements[i].focus();
			return false;
		} 
		else
		return true;
	}      
</script>
</head>
<body>
<center>
<form action="index.php?do=send" method="POST">
<p><a href="index.html">
<img alt="" src="images/doctors.png"></a></p>
	<h1>Welcome to Douglas Medical Specialists!</h1>
<p>Please fill in the questioner below.</p>
<p><font color="red">*</font> Required Fields</p> <span style="color:red;">
<?php
	if ($message)
	echo "$message"; 
?>
</span>
   <table border="1" width="500">
	<TR bgcolor="#B2C6DE">
	<TD align="center" colSpan=6>Patient Information</TD>
	</TR>
   <tr><td width="150px">
   <font color="red">*</font> First Name: </td><td><input type="text" name="fname" size="20" value="<?php echo @$fname ?>"

   						onkeypress="return handleEnter(this, event);"

   						onKeyDown="limitText(this.form.fname,this.form.countdown9,45);" 

						onKeyUp="limitText(this.form.fname,this.form.countdown9,45);">

   </td></tr>
   <tr><td>
   <font color="red">*</font> Last Name: </td><td><input type="text" name="lname" size="20" value="<?php echo @$lname ?>"

   						onkeypress="return handleEnter(this, event);"
   						onKeyDown="limitText(this.form.lname,this.form.countdown10,45);" 
						onKeyUp="limitText(this.form.lname,this.form.countdown10,45);">
   </td></tr>
   <tr><td>
   Phone Number: </td><td><input type="text" name="phone" size="20" value="<?php echo @$phone ?>"
   						onkeypress="return handleEnter(this, event);"
   						onKeyDown="limitText(this.form.phone,this.form.countdown11,12);" 
						onKeyUp="limitText(this.form.phone,this.form.countdown11,12);">
   </td></tr>
   <tr><td>
   Address: </td><td><input type="text" name="addr" size="20" value="<?php echo @$addr ?>"
   						onkeypress="return handleEnter(this, event);"
   						onKeyDown="limitText(this.form.addr,this.form.countdown12,80);" 
						onKeyUp="limitText(this.form.addr,this.form.countdown12,80);">
   </td></tr>
   <tr><td>
   City: </td><td><input type="text" name="city" size="20" value="<?php echo @$city ?>"
   						onkeypress="return handleEnter(this, event);"
   						onKeyDown="limitText(this.form.city,this.form.countdown13,20);" 
						onKeyUp="limitText(this.form.city,this.form.countdown13,20);">
   </td></tr>
   <tr><td>
   State: </td><td><input type="text" name="state" size="20" value="<?php echo @$state ?>"
   						onkeypress="return handleEnter(this, event);"
   						onKeyDown="limitText(this.form.state,this.form.countdown14,2);" 
						onKeyUp="limitText(this.form.state,this.form.countdown14,2);">
   </td></tr>
   <tr><td>
   Zip: </td><td><input type="text" name="zip" size="20" value="<?php echo @$zip ?>"
   						onkeypress="return handleEnter(this, event);"
   						onKeyDown="limitText(this.form.zip,this.form.countdown15,5);" 
						onKeyUp="limitText(this.form.zip,this.form.countdown15,5);">
   </td></tr>
   <tr><td>
   Email: </td><td><input type="text" name="email" size="20" value="<?php echo @$email ?>"
   						onkeypress="return handleEnter(this, event);"
   						onKeyDown="limitText(this.form.email,this.form.countdown16,50);" 
						onKeyUp="limitText(this.form.email,this.form.countdown16,50);">
   </td></tr>
   <tr><td>

   Date of Birth: </td><td><input type="text" name="dob" size="20" value="<?php echo @$dob ?>"

   						onkeypress="return handleEnter(this, event);"

   						onKeyDown="limitText(this.form.dob,this.form.countdown17,10);" 

						onKeyUp="limitText(this.form.dob,this.form.countdown17,10);">

   </td></tr>

   </table>



   <table border="1" width="500">

	<TR bgcolor="#B2C6DE">

	<TD align="center" colSpan=6>Questioner</TD>

	</TR>

   <tr><td>
	Are you interested in the following services?<br>
   <input type="checkbox" name="cardiosurgery" value="YES"> Cardiovascular Surgery<br>
   <input type="checkbox" name="schdocvisits" value="YES"> Scheduling Regular Doctor Visits<br>
   <input type="checkbox" name="homecare" value="YES"> Home Care (Housekeeping, Laundry, Meal Prep, etc.)<br>
   <input type="checkbox" name="ekgtesting" value="YES"> EKG Testing<br>
   <input type="checkbox" name="bloodwork" value="YES"> Blood Work<br>
   <input type="checkbox" name="other" > Other - Please Specify:<br>
   
   Other Information:<br>
   <textarea rows="5" cols="40" name="othermsg" 
   						onkeypress="return handleEnter(this, event);"
   						onKeyDown="limitText(this.form.othermsg,this.form.countdown18,240);" 
						onKeyUp="limitText(this.form.othermsg,this.form.countdown18,240);"
						><?php echo @$othermsg ?></textarea>

   </td></tr>
	<tr><td>How did you hear about Douglas Medical Specialists?<br>
	 <textarea rows="5" cols="40" name="howhear" 
	 					onkeypress="return handleEnter(this, event);"
	 					onKeyDown="limitText(this.form.howhear,this.form.countdown19,240);" 
						onKeyUp="limitText(this.form.howhear,this.form.countdown19,240);"
						><?php echo @$howhear ?></textarea></td></tr>
</table>
<br>
<input type="submit" name="submit" value="Click Here to Submit" style="height: 75px; width: 400px; font-size: 24px;">
   </form>
   </center>
</body>
</html>

<!-- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||| End HTML CODE |||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -->

Open in new window

0
Ray PaseurCommented:
The SSCCE to create a file name cannot possibly be 300+ lines of code.

Have you got a version control system?  It's very helpful when you break something along the way -- you just roll back to the last stable version.  If you're not using one, you might get a lot of value out of this article.
http://www.experts-exchange.com/Software/Development/Management_Debug/Version_Control_CVS/A_12235-Git-101.html
0
rodneygrayAuthor Commented:
Actually the 337 lines are the full project, started to go off topic with this one. Thanks for the heads up about GIT, I have been looking for a version control software for awhile.
0
Ray PaseurCommented:
Thanks for the points, ~Ray
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.