Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PHP unexpected EOF

Posted on 2011-09-07
11
Medium Priority
?
341 Views
Last Modified: 2012-05-12
Hi I have been working on this for a while, it's not a complicated script, but I've been looking at it for ages and I'm sure I'm missing something really simple.

I think a pair of fresh eyes will greatly help.

Thank for your help.

<?php 
session_start();
//main.php
require_once('connection.php');
if(isset($_SESSION['user']))
{

//$sql="SELECT * FROM $tbl_name WHERE user='$myusername'";
$id = $_GET['ID'];
$sql="SELECT * FROM harvest WHERE ID='$ID'";
$result=mysql_query($sql);
$row = mysql_fetch_array($result);

$title=$row[title];
$fname = $row[f_name];
$sname = $row[s_name];
$dob = explode("/",$row[DOB]);
$dob_d = $dob[0];
$dob_m = $dob[1];
$dob_y = $dob[2];

$marital = $row[marital];

$add1 = $row[house];
$add2 = $row[street];
$add3 = $row[city];
$postcode = $row[postcode];

$tel1 = $row[m_tel];
$tel2 = $row[h_tel];

$email = $row[email];

$appt = explode("-",$row[ApptDate]);

$appt_d = $appt[2];
$appt_m = $appt[1]; 
$appt_y = $appt[0];

$apptT = explode(":",$row[ApptTime]);

$appt_h = $apptT[0];
$appt_m = $apptT[1];

$status = $row[Status];

$accepted = explode("-",$row['AcceptedDate']);
$acc_D = $accepted[2];
$acc_M = $accepted[1];
$acc_Y = $accepted[0]; 

$rejRea = $row[RejectionReason];

$solution = $row[Solution];

$solVal = $row[Value];

$firstVal = $row[FirstPaymentValue];

$addedCost = $row[AddedCost];

$compOwed = $row[CompaniesOwed];

$debtAmount = $row[DebtAmmount];

$partnerDebt = $row[PartnerDebt];

$partnerWork = $row[PartnerWork];

$partnerBenefits = $row[PartnerBenefits];

$firstPaymentDate = explode("-",$row[FirstPaymentDate]);

$fp_day = $firstPaymentDate[2];
$fp_month = $firstPaymentDate[1];
$fp_year = $firstPaymentDate[0];


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Edit page OBFTS</title>
</head>

<body>

<div id="edit_container">
 

<strong>Name</strong>
<br />
<form id="edit_customer" action="update.php">
<input name="title"/>


<input name="first_name"/>


<input name="last_name"/>

<br  class="clearfix"/>
<strong>Date of Birth </strong>
<br  />
<input name="day" value="<?php echo $dob_d; ?>" />
<input name="month" value="<?php echo $dob_m; ?>" />
<input name="year" value="<?php echo $dob_y; ?>" />

<br  class="clearfix"/>
<strong>Marital:</strong> <br  />
<select name="marital">
<option value="single" <?php if($marital=='single'){?> selected="selected"<?php } ?>>Single</option>
<option value="divorced" <?php if($marital=='divorced'){?> selected="selected"<?php } ?> >Divorced</option>
<option value="married" <?php if($marital=='married'){?> selected="selected"<?php } ?> >Married</option>
<option value="together" <?php if($marital=='together'){?> selected="selected"<?php } ?> >Living together</option>
<option value="Widowed" <?php if($marital=='widowed'){?> selected="selected"<?php } ?> >Widowed</option>
<option value="Separated" <?php if($marital=='Seperated'){?> selected="selected"<?php } ?> >Separated</option>
 </select>
 <br  class="clearfix"/>
 
<strong>Address:</strong> <br  />
<input  name="add1" value="<?php echo $add1; ?>"/><br  />
<input  name="add2" value="<?php echo $add2; ?>"/><br  />
<input  name="add3" value="<?php echo $add3; ?>"/> <br />
<input  name="postcode" value="<?php echo $postcode; ?>" />
<br class="clearfix" />

<strong>Telephone Numbers</strong> <br  />
<input name="tel1" value="<?php echo $tel1; ?>"/>
<input name="tel2" value="<?php echo $tel2; ?>"/>

<br  class="clearfix"/>
<strong>Email</strong><br />
<input name="email"  value="<?php echo $email; ?>"/> />
<br  />
<textarea name="notes" cols="50" rows="15" >Notes</textarea>

<br class="clearfix" />
<h2>Callback/Appointment Details</h2>
<strong>Appointment Date</strong><br />
<select name="appt_day">


<option value="">dd</option>
<?php
					$i =01;
					while ($i <= 31) {
						echo "<option  value=\" $i \"";  if($i == $appt_d) { echo "selected=\"selected\""; } echo ">$i</option>";
						$i++; 
					}

?>
 </select>
<select name="appt_month"><option  value=""></option>
<?php
					$i =01;
					while ($i <= 12) {
						echo "<option  value=\" $i \"";  if($i == $appt_m) { echo "selected=\"selected\""; } echo ">$i</option>";
						$i++; 

					}
?>

 </select>
<select name="appt_year"><option value="" selected="selected"></option>

<?php
					$i =2011;
					while ($i <= 2014) {
						echo "<option  value=\" $i \"";  if($i == $appt_y) { echo "selected=\"selected\""; } echo ">$i</option>";
						$i++; 

					}
?>

 </select>
<br class="clearfix" />


<strong>Appointment Time</strong><br />
<select name="appt_hours"><option value=""> </option>
<?php
					
					$i =00;
					while ($i <= 23) {
						echo "<option  value=\" $i \"";  if($i == $appt_h) { echo "selected=\"selected\""; }  echo ">$i</option>";
						$i++; 

					}
?>

 </select>
<select name="appt_mins"><option value=""></option>


<?php
					
					$i =00;
					while ($i <= 59) {
						echo "<option  value=\" $i \"";  if($i == $appt_m) { echo "selected=\"selected\""; }  echo ">$i</option>";
						$i++; 

					}
?>

 </select>

<br class="clearfix">

<textarea name="appt_notes" cols="50" rows="15"> </textarea>

<br class="clearfix" />

<h2>Call Details</h2>
<strong>Call Status </strong> <br />
<select name="callStatus"> 
<option value=""></option>
<option <?php if($status == signed ) {?> selected="selected"<?php } ?>  value="signed">Signed</option>
<option value="cf" <?php if($status == 'cf' ) {?> selected="selected"<?php } ?> >CF</option>
<option value="pbo" <?php if($status == 'pbo' ) {?> selected="selected"<?php } ?> >PBO</option>
</select>
<br class="clearfix">

<strong>Accepted Date</strong> <br />
<input name="acc_day" value="<?php echo $acc_D; ?>" />
<input name="acc_month" value="<?php echo $acc_M; ?>" />
<input name="acc_year" value="<?php echo $acc_Y; ?>">

<br class="clearfix" />

<strong>Rejection reason</strong> <br />
<select name="rejReason"><option value=""></option>
<option value="1c" <?php if($rejRea == "1c" ) {?> selected="selected"<?php } ?>>Only one creditor</option>
<option value="ni" <?php if($rejRea == "ni" ) {?> selected="selected"<?php } ?>>Not interested</option>
<option value="ca" <?php if($rejRea == "ca" ) {?> selected="selected"<?php } ?>>Can't afford min</option>
<option value="fees" <?php if($rejRea == "fees" ) {?> selected="selected"<?php } ?>>fees</option>
<option value="wcb" <?php if($rejRea == "wcb" ) {?> selected="selected"<?php } ?>>Won't change bank</option>
<option value="nc" <?php if($rejRea == "nc" ) {?> selected="selected"<?php } ?>>No Contact</option>
<option value="bos" <?php if($rejRea == "bos" ) {?> selected="selected"<?php } ?>>bos</option>
</select>

<br class="clearfix" />

<strong>Solution</strong> <br />
<select name="solution">
<option value=""></option>
<option value="dmp" <?php if($Solution == "dmp" ) {?> selected="selected"<?php } ?> >DMP</option>
<option value="ppi" <?php if($Solution == "ppi" ) {?> selected="selected"<?php } ?> >PPI</option>
<option value="lf" <?php if($Solution == "lf" ) {?> selected="selected"<?php } ?> >Loan Referral</option>
</select>

<br class="clearfix" />

<strong>Solution Value</strong> <br />
<input type="text" name="solutionValue" value="<?php echo $solVal; ?>" />

<br class="clearfix"/>


<strong>First Payment Value</strong> <br />
<input type="text" name="firstPaymentValue" value="<?php echo $firstVal; ?>" />

<br class="clearfix"/>

<strong>Added Cost</strong> <br />
<input type="text" name="addedCost" value="<?php echo $addedCost; ?>" />

<br class="clearfix"/>


<strong>First Payment Date</strong> <br />  
<input type="text" name="fp_day"  <?php if ($fp_day != "")  {?> value="dd" <?php } else {?> value="<?php echo $fp_day; ?>"  />
<input type="text" name="fp_month" <?php if ($fp_month != "")  {?> value="mm" <?php } else {?> value="<?php echo $fp_month; ?>" />
<input type="text" name="fp_month" <?php if ($fp_year != "")  {?> value="yyyy" <?php } else {?> value="<?php echo $fp_year; ?>" />

<br class="clearfix"/>

<h2>Debts </h2>

<strong>Debt Amount </strong><br />
<select name="debtAmount">
<option value="">Not Set</option>
<option value="1" <?php if($debtAmount == "1" ) {?> selected="selected"<?php } ?>>under &pound;2,000</option>
<option value="2"<?php if($debtAmount == "2" ) {?> selected="selected"<?php } ?>> &pound;2,000 - &pound;5,000</option>
<option value="3" <?php if($debtAmount == "3" ) {?> selected="selected"<?php } ?>>&pound;5,000 - &pound;10,000</option>
<option value="4" <?php if($debtAmount == "4" ) {?> selected="selected"<?php } ?>>&pound;10,000 - &pound;15,000</option>
<option value="5" <?php if($debtAmount == "5" ) {?> selected="selected"<?php } ?>>&pound;15,000 - &pound;25,000</option>
<option value="6" <?php if($debtAmount == "6" ) {?> selected="selected"<?php } ?>>&pound;25,000 - &pound;50,000</option>
<option value="7" <?php if($debtAmount == "7" ) {?> selected="selected"<?php } ?>>&pound;50,000 - &pound;75,000</option>
<option value="8" <?php if($debtAmount == "8" ) {?> selected="selected"<?php } ?>>&pound;75,000 - &pound;100,000</option>
<option value="9" <?php if($debtAmount == "9" ) {?> selected="selected"<?php } ?>>&pound;100,000+</option>
</select>

<strong>Companies Owed </strong><br />
<select name="companiesOwed">
<option value="">Not Set</option>
<?php
					
					$i =00;
					while ($i <= 20) {
						echo "<option  value=\" $i \"";  if($i == $compOwed) { echo "selected=\"selected\""; } echo ">$i</option>";
						$i++; 
					}

?>

</select>

<strong>Partner Debt</strong><br />
<select name="partnerDebt">
<option value="">Not Set</option>
<option value="yes" <?php if($partnerDebt == "yes") { echo "selected=\"selected\""; } ?>>yes</option>
<option value="no" <?php if($partnerDebt == "no") { echo "selected=\"selected\""; } ?>>No</option> 
</select>

<strong>Partner Work</strong><br />
<select name="partnerWork">
<option value="">Not Set</option>
<option value="yes" <?php if($partnerWork == "yes") { echo "selected=\"selected\""; } ?>>Yes</option>
<option value="no" <?php if($partnerWork == "no") { echo "selected=\"selected\""; } ?>>No</option> 
</select>

<strong>Partner Benefits</strong><br />
<select name="partnerBenefits">
<option value="">Not Set</option>
<option value="yes" <?php if($partnerBenefits == "yes") { echo "selected=\"selected\""; } ?>>Yes</option>
<option value="no" <?php if($partnerBenefits == "no") { echo "selected=\"selected\""; } ?>>No</option> 
</select>

<input type="submit" value="Update">

</form>
  
  
</div>

</body>
</html>

<?php }

else {
header("location:index.php");
}

?>

Open in new window

0
Comment
Question by:Everlearner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 31

Assisted Solution

by:Marco Gasi
Marco Gasi earned 332 total points
ID: 36496084
When there are many php tags within a html document can happens some problem. Using Netbeans IDE (www.netbeans.org) eof problem is highlighted but analyzing your code I can't get rid of that. So I tried to use heredoc notation and now I have no errors: try to see if it work correctly. I attach the code in the snippet box.

Cheers
<?php
session_start();
//main.php
require_once('connection.php');
if (isset($_SESSION['user'])) {

//$sql="SELECT * FROM $tbl_name WHERE user='$myusername'";
    $id = $_GET['ID'];
    $sql = "SELECT * FROM harvest WHERE ID='$ID'";
    $result = mysql_query($sql);
    $row = mysql_fetch_array($result);

    $title = $row[title];
    $fname = $row[f_name];
    $sname = $row[s_name];
    $dob = explode("/", $row[DOB]);
    $dob_d = $dob[0];
    $dob_m = $dob[1];
    $dob_y = $dob[2];

    $marital = $row[marital];

    $add1 = $row[house];
    $add2 = $row[street];
    $add3 = $row[city];
    $postcode = $row[postcode];

    $tel1 = $row[m_tel];
    $tel2 = $row[h_tel];

    $email = $row[email];

    $appt = explode("-", $row[ApptDate]);

    $appt_d = $appt[2];
    $appt_m = $appt[1];
    $appt_y = $appt[0];

    $apptT = explode(":", $row[ApptTime]);

    $appt_h = $apptT[0];
    $appt_m = $apptT[1];

    $status = $row[Status];

    $accepted = explode("-", $row['AcceptedDate']);
    $acc_D = $accepted[2];
    $acc_M = $accepted[1];
    $acc_Y = $accepted[0];

    $rejRea = $row[RejectionReason];

    $solution = $row[Solution];

    $solVal = $row[Value];

    $firstVal = $row[FirstPaymentValue];

    $addedCost = $row[AddedCost];

    $compOwed = $row[CompaniesOwed];

    $debtAmount = $row[DebtAmmount];

    $partnerDebt = $row[PartnerDebt];

    $partnerWork = $row[PartnerWork];

    $partnerBenefits = $row[PartnerBenefits];

    $firstPaymentDate = explode("-", $row[FirstPaymentDate]);

    $fp_day = $firstPaymentDate[2];
    $fp_month = $firstPaymentDate[1];
    $fp_year = $firstPaymentDate[0];
    

print<<<_HTML_
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>Edit page OBFTS</title>
        </head>

        <body>

            <div id="edit_container">


                <strong>Name</strong>
                <br />
                <form id="edit_customer" action="update.php">
                    <input name="title"/>


                    <input name="first_name"/>


                    <input name="last_name"/>

                    <br  class="clearfix"/>
                    <strong>Date of Birth </strong>
                    <br  />
                    <input name="day" value=" echo $dob_d; " />
                    <input name="month" value=" echo $dob_m; " />
                    <input name="year" value=" echo $dob_y; " />

                    <br  class="clearfix"/>
                    <strong>Marital:</strong> <br  />
                    <select name="marital">
                        <option value="single"  if ($marital == 'single') {  selected="selected" } >Single</option>
                        <option value="divorced"  if ($marital == 'divorced') {  selected="selected" }  >Divorced</option>
                        <option value="married"  if ($marital == 'married') {  selected="selected" }  >Married</option>
                        <option value="together"  if ($marital == 'together') {  selected="selected" }  >Living together</option>
                        <option value="Widowed"  if ($marital == 'widowed') {  selected="selected" }  >Widowed</option>
                        <option value="Separated"  if ($marital == 'Seperated') {  selected="selected" }  >Separated</option>
                    </select>
                    <br  class="clearfix"/>

                    <strong>Address:</strong> <br  />
                    <input  name="add1" value=" echo $add1; "/><br  />
                    <input  name="add2" value=" echo $add2; "/><br  />
                    <input  name="add3" value=" echo $add3; "/> <br />
                    <input  name="postcode" value=" echo $postcode; " />
                    <br class="clearfix" />

                    <strong>Telephone Numbers</strong> <br  />
                    <input name="tel1" value=" echo $tel1; "/>
                    <input name="tel2" value=" echo $tel2; "/>

                    <br  class="clearfix"/>
                    <strong>Email</strong><br />
                    <input name="email"  value=" echo $email; "/> />
                    <br  />
                    <textarea name="notes" cols="50" rows="15" >Notes</textarea>

                    <br class="clearfix" />
                    <h2>Callback/Appointment Details</h2>
                    <strong>Appointment Date</strong><br />
                    <select name="appt_day">


                        <option value="">dd</option>
    
    $i = 01;
    while ($i <= 31) {
        echo "<option  value=\" $i \"";
        if ($i == $appt_d) {
            echo "selected=\"selected\"";
        } echo ">$i</option>";
        $i++;
    }
    
                    </select>
                    <select name="appt_month"><option  value=""></option>
                        
                        $i = 01;
                        while ($i <= 12) {
                            echo "<option  value=\" $i \"";
                            if ($i == $appt_m) {
                                echo "selected=\"selected\"";
                            } echo ">$i</option>";
                            $i++;
                        }
                        

                    </select>
                    <select name="appt_year"><option value="" selected="selected"></option>

                        
                        $i = 2011;
                        while ($i <= 2014) {
                            echo "<option  value=\" $i \"";
                            if ($i == $appt_y) {
                                echo "selected=\"selected\"";
                            } echo ">$i</option>";
                            $i++;
                        }
                        

                    </select>
                    <br class="clearfix" />


                    <strong>Appointment Time</strong><br />
                    <select name="appt_hours"><option value=""> </option>
                        
                        $i = 00;
                        while ($i <= 23) {
                            echo "<option  value=\" $i \"";
                            if ($i == $appt_h) {
                                echo "selected=\"selected\"";
                            } echo ">$i</option>";
                            $i++;
                        }
                        

                    </select>
                    <select name="appt_mins"><option value=""></option>


                        
                        $i = 00;
                        while ($i <= 59) {
                            echo "<option  value=\" $i \"";
                            if ($i == $appt_m) {
                                echo "selected=\"selected\"";
                            } echo ">$i</option>";
                            $i++;
                        }
                        

                    </select>

                    <br class="clearfix">

                        <textarea name="appt_notes" cols="50" rows="15"> </textarea>

                        <br class="clearfix" />

                        <h2>Call Details</h2>
                        <strong>Call Status </strong> <br />
                        <select name="callStatus"> 
                            <option value=""></option>
                            <option  if ($status == signed) {  selected="selected" }   value="signed">Signed</option>
                            <option value="cf"  if ($status == 'cf') {  selected="selected" }  >CF</option>
                            <option value="pbo"  if ($status == 'pbo') {  selected="selected" }  >PBO</option>
                        </select>
                        <br class="clearfix">

                            <strong>Accepted Date</strong> <br />
                            <input name="acc_day" value=" echo $acc_D; " />
                            <input name="acc_month" value=" echo $acc_M; " />
                            <input name="acc_year" value=" echo $acc_Y; " />

                                <br class="clearfix" />

                                <strong>Rejection reason</strong> <br />
                                <select name="rejReason"><option value=""></option>
                                    <option value="1c"  if ($rejRea == "1c") {  selected="selected" } >Only one creditor</option>
                                    <option value="ni"  if ($rejRea == "ni") {  selected="selected" } >Not interested</option>
                                    <option value="ca"  if ($rejRea == "ca") {  selected="selected" } >Can't afford min</option>
                                    <option value="fees"  if ($rejRea == "fees") {  selected="selected" } >fees</option>
                                    <option value="wcb"  if ($rejRea == "wcb") {  selected="selected" } >Won't change bank</option>
                                    <option value="nc"  if ($rejRea == "nc") {  selected="selected" } >No Contact</option>
                                    <option value="bos"  if ($rejRea == "bos") {  selected="selected" } >bos</option>
                                </select>

                                <br class="clearfix" />

                                <strong>Solution</strong> <br />
                                <select name="solution">
                                    <option value=""></option>
                                    <option value="dmp"  if ($Solution == "dmp") {  selected="selected" }  >DMP</option>
                                    <option value="ppi"  if ($Solution == "ppi") {  selected="selected" }  >PPI</option>
                                    <option value="lf"  if ($Solution == "lf") {  selected="selected" }  >Loan Referral</option>
                                </select>

                                <br class="clearfix" />

                                <strong>Solution Value</strong> <br />
                                <input type="text" name="solutionValue" value=" echo $solVal; " />

                                <br class="clearfix"/>


                                <strong>First Payment Value</strong> <br />
                                <input type="text" name="firstPaymentValue" value=" echo $firstVal; " />

                                <br class="clearfix"/>

                                <strong>Added Cost</strong> <br />
                                <input type="text" name="addedCost" value=" echo $addedCost; " />

                                <br class="clearfix"/>


                                <strong>First Payment Date</strong> <br />  
                                <input type="text" name="fp_day"   if ($fp_day != "") {  value="dd"  } else {  value=" echo $fp_day; "  />
                                    <input type="text" name="fp_month"  if ($fp_month != "") {  value="mm"  } else {  value=" echo $fp_month; " />
                                        <input type="text" name="fp_month"  if ($fp_year != "") {  value="yyyy"  } else {  value=" echo $fp_year; " />

                                            <br class="clearfix"/>

                                            <h2>Debts </h2>

                                            <strong>Debt Amount </strong><br />
                                            <select name="debtAmount">
                                                <option value="">Not Set</option>
                                                <option value="1"  if ($debtAmount == "1") {  selected="selected" } >under &pound;2,000</option>
                                                <option value="2"  if ($debtAmount == "2") {  selected="selected" } > &pound;2,000 - &pound;5,000</option>
                                                <option value="3"  if ($debtAmount == "3") {  selected="selected" } >&pound;5,000 - &pound;10,000</option>
                                                <option value="4"  if ($debtAmount == "4") {  selected="selected" } >&pound;10,000 - &pound;15,000</option>
                                                <option value="5"  if ($debtAmount == "5") {  selected="selected" } >&pound;15,000 - &pound;25,000</option>
                                                <option value="6"  if ($debtAmount == "6") {  selected="selected" } >&pound;25,000 - &pound;50,000</option>
                                                <option value="7"  if ($debtAmount == "7") {  selected="selected" } >&pound;50,000 - &pound;75,000</option>
                                                <option value="8"  if ($debtAmount == "8") {  selected="selected" } >&pound;75,000 - &pound;100,000</option>
                                                <option value="9"  if ($debtAmount == "9") {  selected="selected" } >&pound;100,000+</option>
                                            </select>

                                            <strong>Companies Owed </strong><br />
                                            <select name="companiesOwed">
                                                <option value="">Not Set</option>
                                                
                                                $i = 00;
                                                while ($i <= 20) {
                                                    echo "<option  value=\" $i \"";
                                                    if ($i == $compOwed) {
                                                        echo "selected=\"selected\"";
                                                    } echo ">$i</option>";
                                                    $i++;
                                                }
                                                

                                            </select>

                                            <strong>Partner Debt</strong><br />
                                            <select name="partnerDebt">
                                                <option value="">Not Set</option>
                                                <option value="yes"  if ($partnerDebt == "yes") {
                                                    echo "selected=\"selected\"";
                                                } >yes</option>
                                                <option value="no"  if ($partnerDebt == "no") {
                                                    echo "selected=\"selected\"";
                                                } >No</option> 
                                            </select>

                                            <strong>Partner Work</strong><br />
                                            <select name="partnerWork">
                                                <option value="">Not Set</option>
                                                <option value="yes"  if ($partnerWork == "yes") {
                                                    echo "selected=\"selected\"";
                                                } >Yes</option>
                                                <option value="no"  if ($partnerWork == "no") {
                                                    echo "selected=\"selected\"";
                                                } >No</option> 
                                            </select>

                                            <strong>Partner Benefits</strong><br />
                                            <select name="partnerBenefits">
                                                <option value="">Not Set</option>
                                                <option value="yes"  if ($partnerBenefits == "yes") {
                                                    echo "selected=\"selected\"";
                                                } >Yes</option>
                                                <option value="no"  if ($partnerBenefits == "no") {
                                    echo "selected=\"selected\"";
                                } >No</option> 
                                            </select>

                                            <input type="submit" value="Update">

                                                </form>


                                                </div>

                                                </body>
                                                </html>

_HTML_;
    
} else {
                header("location:index.php");
            }

?>

Open in new window

0
 
LVL 14

Expert Comment

by:Scott Madeira
ID: 36496097
One problem I see is that you reference your array values as:

$add1 = $row[house];

when it should be:

$add1 = $row['house'];


you need quotes around your array indicies when you use strings.
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 36496106
Sorry, the right file is this:
<?php
session_start();
//main.php
require_once('connection.php');
if (isset($_SESSION['user'])) {

//$sql="SELECT * FROM $tbl_name WHERE user='$myusername'";
    $id = $_GET['ID'];
    $sql = "SELECT * FROM harvest WHERE ID='$ID'";
    $result = mysql_query($sql);
    $row = mysql_fetch_array($result);

    $title = $row[title];
    $fname = $row[f_name];
    $sname = $row[s_name];
    $dob = explode("/", $row[DOB]);
    $dob_d = $dob[0];
    $dob_m = $dob[1];
    $dob_y = $dob[2];

    $marital = $row[marital];

    $add1 = $row[house];
    $add2 = $row[street];
    $add3 = $row[city];
    $postcode = $row[postcode];

    $tel1 = $row[m_tel];
    $tel2 = $row[h_tel];

    $email = $row[email];

    $appt = explode("-", $row[ApptDate]);

    $appt_d = $appt[2];
    $appt_m = $appt[1];
    $appt_y = $appt[0];

    $apptT = explode(":", $row[ApptTime]);

    $appt_h = $apptT[0];
    $appt_m = $apptT[1];

    $status = $row[Status];

    $accepted = explode("-", $row['AcceptedDate']);
    $acc_D = $accepted[2];
    $acc_M = $accepted[1];
    $acc_Y = $accepted[0];

    $rejRea = $row[RejectionReason];

    $solution = $row[Solution];

    $solVal = $row[Value];

    $firstVal = $row[FirstPaymentValue];

    $addedCost = $row[AddedCost];

    $compOwed = $row[CompaniesOwed];

    $debtAmount = $row[DebtAmmount];

    $partnerDebt = $row[PartnerDebt];

    $partnerWork = $row[PartnerWork];

    $partnerBenefits = $row[PartnerBenefits];

    $firstPaymentDate = explode("-", $row[FirstPaymentDate]);

    $fp_day = $firstPaymentDate[2];
    $fp_month = $firstPaymentDate[1];
    $fp_year = $firstPaymentDate[0];
    
print<<<_HTML_
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>Edit page OBFTS</title>
        </head>

        <body>

            <div id="edit_container">


                <strong>Name</strong>
                <br />
                <form id="edit_customer" action="update.php">
                    <input name="title"/>


                    <input name="first_name"/>


                    <input name="last_name"/>

                    <br  class="clearfix"/>
                    <strong>Date of Birth </strong>
                    <br  />
                    <input name="day" value="<?php echo $dob_d; ?>" />
                    <input name="month" value="<?php echo $dob_m; ?>" />
                    <input name="year" value="<?php echo $dob_y; ?>" />

                    <br  class="clearfix"/>
                    <strong>Marital:</strong> <br  />
                    <select name="marital">
                        <option value="single" <?php if ($marital == 'single') { ?> selected="selected"<?php } ?>>Single</option>
                        <option value="divorced" <?php if ($marital == 'divorced') { ?> selected="selected"<?php } ?> >Divorced</option>
                        <option value="married" <?php if ($marital == 'married') { ?> selected="selected"<?php } ?> >Married</option>
                        <option value="together" <?php if ($marital == 'together') { ?> selected="selected"<?php } ?> >Living together</option>
                        <option value="Widowed" <?php if ($marital == 'widowed') { ?> selected="selected"<?php } ?> >Widowed</option>
                        <option value="Separated" <?php if ($marital == 'Seperated') { ?> selected="selected"<?php } ?> >Separated</option>
                    </select>
                    <br  class="clearfix"/>

                    <strong>Address:</strong> <br  />
                    <input  name="add1" value="<?php echo $add1; ?>"/><br  />
                    <input  name="add2" value="<?php echo $add2; ?>"/><br  />
                    <input  name="add3" value="<?php echo $add3; ?>"/> <br />
                    <input  name="postcode" value="<?php echo $postcode; ?>" />
                    <br class="clearfix" />

                    <strong>Telephone Numbers</strong> <br  />
                    <input name="tel1" value="<?php echo $tel1; ?>"/>
                    <input name="tel2" value="<?php echo $tel2; ?>"/>

                    <br  class="clearfix"/>
                    <strong>Email</strong><br />
                    <input name="email"  value="<?php echo $email; ?>"/> />
                    <br  />
                    <textarea name="notes" cols="50" rows="15" >Notes</textarea>

                    <br class="clearfix" />
                    <h2>Callback/Appointment Details</h2>
                    <strong>Appointment Date</strong><br />
                    <select name="appt_day">


                        <option value="">dd</option>
    <?php
    $i = 01;
    while ($i <= 31) {
        echo "<option  value=\" $i \"";
        if ($i == $appt_d) {
            echo "selected=\"selected\"";
        } echo ">$i</option>";
        $i++;
    }
    ?>
                    </select>
                    <select name="appt_month"><option  value=""></option>
                        <?php
                        $i = 01;
                        while ($i <= 12) {
                            echo "<option  value=\" $i \"";
                            if ($i == $appt_m) {
                                echo "selected=\"selected\"";
                            } echo ">$i</option>";
                            $i++;
                        }
                        ?>

                    </select>
                    <select name="appt_year"><option value="" selected="selected"></option>

                        <?php
                        $i = 2011;
                        while ($i <= 2014) {
                            echo "<option  value=\" $i \"";
                            if ($i == $appt_y) {
                                echo "selected=\"selected\"";
                            } echo ">$i</option>";
                            $i++;
                        }
                        ?>

                    </select>
                    <br class="clearfix" />


                    <strong>Appointment Time</strong><br />
                    <select name="appt_hours"><option value=""> </option>
                        <?php
                        $i = 00;
                        while ($i <= 23) {
                            echo "<option  value=\" $i \"";
                            if ($i == $appt_h) {
                                echo "selected=\"selected\"";
                            } echo ">$i</option>";
                            $i++;
                        }
                        ?>

                    </select>
                    <select name="appt_mins"><option value=""></option>


                        <?php
                        $i = 00;
                        while ($i <= 59) {
                            echo "<option  value=\" $i \"";
                            if ($i == $appt_m) {
                                echo "selected=\"selected\"";
                            } echo ">$i</option>";
                            $i++;
                        }
                        ?>

                    </select>

                    <br class="clearfix">

                        <textarea name="appt_notes" cols="50" rows="15"> </textarea>

                        <br class="clearfix" />

                        <h2>Call Details</h2>
                        <strong>Call Status </strong> <br />
                        <select name="callStatus"> 
                            <option value=""></option>
                            <option <?php if ($status == signed) { ?> selected="selected"<?php } ?>  value="signed">Signed</option>
                            <option value="cf" <?php if ($status == 'cf') { ?> selected="selected"<?php } ?> >CF</option>
                            <option value="pbo" <?php if ($status == 'pbo') { ?> selected="selected"<?php } ?> >PBO</option>
                        </select>
                        <br class="clearfix">

                            <strong>Accepted Date</strong> <br />
                            <input name="acc_day" value="<?php echo $acc_D; ?>" />
                            <input name="acc_month" value="<?php echo $acc_M; ?>" />
                            <input name="acc_year" value="<?php echo $acc_Y; ?>">

                                <br class="clearfix" />

                                <strong>Rejection reason</strong> <br />
                                <select name="rejReason"><option value=""></option>
                                    <option value="1c" <?php if ($rejRea == "1c") { ?> selected="selected"<?php } ?>>Only one creditor</option>
                                    <option value="ni" <?php if ($rejRea == "ni") { ?> selected="selected"<?php } ?>>Not interested</option>
                                    <option value="ca" <?php if ($rejRea == "ca") { ?> selected="selected"<?php } ?>>Can't afford min</option>
                                    <option value="fees" <?php if ($rejRea == "fees") { ?> selected="selected"<?php } ?>>fees</option>
                                    <option value="wcb" <?php if ($rejRea == "wcb") { ?> selected="selected"<?php } ?>>Won't change bank</option>
                                    <option value="nc" <?php if ($rejRea == "nc") { ?> selected="selected"<?php } ?>>No Contact</option>
                                    <option value="bos" <?php if ($rejRea == "bos") { ?> selected="selected"<?php } ?>>bos</option>
                                </select>

                                <br class="clearfix" />

                                <strong>Solution</strong> <br />
                                <select name="solution">
                                    <option value=""></option>
                                    <option value="dmp" <?php if ($Solution == "dmp") { ?> selected="selected"<?php } ?> >DMP</option>
                                    <option value="ppi" <?php if ($Solution == "ppi") { ?> selected="selected"<?php } ?> >PPI</option>
                                    <option value="lf" <?php if ($Solution == "lf") { ?> selected="selected"<?php } ?> >Loan Referral</option>
                                </select>

                                <br class="clearfix" />

                                <strong>Solution Value</strong> <br />
                                <input type="text" name="solutionValue" value="<?php echo $solVal; ?>" />

                                <br class="clearfix"/>


                                <strong>First Payment Value</strong> <br />
                                <input type="text" name="firstPaymentValue" value="<?php echo $firstVal; ?>" />

                                <br class="clearfix"/>

                                <strong>Added Cost</strong> <br />
                                <input type="text" name="addedCost" value="<?php echo $addedCost; ?>" />

                                <br class="clearfix"/>


                                <strong>First Payment Date</strong> <br />  
                                <input type="text" name="fp_day"  <?php if ($fp_day != "") { ?> value="dd" <?php } else { ?> value="<?php echo $fp_day; ?>"  />
                                    <input type="text" name="fp_month" <?php if ($fp_month != "") { ?> value="mm" <?php } else { ?> value="<?php echo $fp_month; ?>" />
                                        <input type="text" name="fp_month" <?php if ($fp_year != "") { ?> value="yyyy" <?php } else { ?> value="<?php echo $fp_year; ?>" />

                                            <br class="clearfix"/>

                                            <h2>Debts </h2>

                                            <strong>Debt Amount </strong><br />
                                            <select name="debtAmount">
                                                <option value="">Not Set</option>
                                                <option value="1" <?php if ($debtAmount == "1") { ?> selected="selected"<?php } ?>>under &pound;2,000</option>
                                                <option value="2"<?php if ($debtAmount == "2") { ?> selected="selected"<?php } ?>> &pound;2,000 - &pound;5,000</option>
                                                <option value="3" <?php if ($debtAmount == "3") { ?> selected="selected"<?php } ?>>&pound;5,000 - &pound;10,000</option>
                                                <option value="4" <?php if ($debtAmount == "4") { ?> selected="selected"<?php } ?>>&pound;10,000 - &pound;15,000</option>
                                                <option value="5" <?php if ($debtAmount == "5") { ?> selected="selected"<?php } ?>>&pound;15,000 - &pound;25,000</option>
                                                <option value="6" <?php if ($debtAmount == "6") { ?> selected="selected"<?php } ?>>&pound;25,000 - &pound;50,000</option>
                                                <option value="7" <?php if ($debtAmount == "7") { ?> selected="selected"<?php } ?>>&pound;50,000 - &pound;75,000</option>
                                                <option value="8" <?php if ($debtAmount == "8") { ?> selected="selected"<?php } ?>>&pound;75,000 - &pound;100,000</option>
                                                <option value="9" <?php if ($debtAmount == "9") { ?> selected="selected"<?php } ?>>&pound;100,000+</option>
                                            </select>

                                            <strong>Companies Owed </strong><br />
                                            <select name="companiesOwed">
                                                <option value="">Not Set</option>
                                                <?php
                                                $i = 00;
                                                while ($i <= 20) {
                                                    echo "<option  value=\" $i \"";
                                                    if ($i == $compOwed) {
                                                        echo "selected=\"selected\"";
                                                    } echo ">$i</option>";
                                                    $i++;
                                                }
                                                ?>

                                            </select>

                                            <strong>Partner Debt</strong><br />
                                            <select name="partnerDebt">
                                                <option value="">Not Set</option>
                                                <option value="yes" <?php if ($partnerDebt == "yes") {
                                                    echo "selected=\"selected\"";
                                                } ?>>yes</option>
                                                <option value="no" <?php if ($partnerDebt == "no") {
                                                    echo "selected=\"selected\"";
                                                } ?>>No</option> 
                                            </select>

                                            <strong>Partner Work</strong><br />
                                            <select name="partnerWork">
                                                <option value="">Not Set</option>
                                                <option value="yes" <?php if ($partnerWork == "yes") {
                                                    echo "selected=\"selected\"";
                                                } ?>>Yes</option>
                                                <option value="no" <?php if ($partnerWork == "no") {
                                                    echo "selected=\"selected\"";
                                                } ?>>No</option> 
                                            </select>

                                            <strong>Partner Benefits</strong><br />
                                            <select name="partnerBenefits">
                                                <option value="">Not Set</option>
                                                <option value="yes" <?php if ($partnerBenefits == "yes") {
                                                    echo "selected=\"selected\"";
                                                } ?>>Yes</option>
                                                <option value="no" <?php if ($partnerBenefits == "no") {
                                    echo "selected=\"selected\"";
                                } ?>>No</option> 
                                            </select>

                                            <input type="submit" value="Update">

                                                </form>


                                                </div>

                                                </body>
                                                </html>
_HTML_;
            } else {
                header("location:index.php");
            }
            ?>

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 14

Expert Comment

by:Scott Madeira
ID: 36496208
My mistake...  PHP will tolerate bare strings as long as they are not also a defined constant in your script in which case the value of the constant would be substituted for the index.

Was there more of an error message or something that gave a line number?
0
 

Author Comment

by:Everlearner
ID: 36497064
just this as an error...

Parse error: parse error in C:\wamp\www\tracking\edit2.php on line 387


I tried your Heredoc solution and although I didn't get any errors some of the inline php wasn't being executed :s

0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 36497217
Can you tell what code is not executed?

And let me understand: I have only 363 lines...
0
 

Author Comment

by:Everlearner
ID: 36497558
Sorry, yes I added a few conditionals at the top after the explodes in case they were blank so to stop them referencing array members that didn't exist that's why the extra lines of code.

The code not being executed is the stuff within the select elements and input elements, and the while loops that generate the options  
0
 
LVL 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 668 total points
ID: 36497706
What is the question here?  With 300+ lines of code and nothing more to go on than I think a pair of fresh eyes will greatly help. it is hard to know where to look first.  Did you get an error message?  If so, what line number?

I see some things that seem to involve date and/or time processing. You can learn how to do that in this article.  It is much simpler than you might think.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html

I see some things that seem to involve copying variables from the $row array into the local variables scope.  That is known as "variable proliferation" and it is almost always a red flag in programming.  There is no extra credit (but there is extra confusion) when variable proliferation is involved.

I see a lot of select and option tags.  Usually the way these are generated would be to have an array (perhaps from a data base) that matches the name of the input control to the options.  Often an array of objects is useful for generating these tags.

I think you might really enjoy this book.  It is full of good explanations and useful examples, many of them covering the kinds of things you are trying to do here.
http://www.sitepoint.com/books/phpmysql4/

Please post back with any specific questions, and we can try to help.  Best regards, ~Ray
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 36497960
Try to use nowdoc instead: nowdoc notation should be good for embedding php code. Please copy and paste the code below and test it.
<?php
session_start();
//main.php
require_once('connection.php');
if (isset($_SESSION['user'])) {

//$sql="SELECT * FROM $tbl_name WHERE user='$myusername'";
    $id = $_GET['ID'];
    $sql = "SELECT * FROM harvest WHERE ID='$ID'";
    $result = mysql_query($sql);
    $row = mysql_fetch_array($result);

    $title = $row[title];
    $fname = $row[f_name];
    $sname = $row[s_name];
    $dob = explode("/", $row[DOB]);
    $dob_d = $dob[0];
    $dob_m = $dob[1];
    $dob_y = $dob[2];

    $marital = $row[marital];

    $add1 = $row[house];
    $add2 = $row[street];
    $add3 = $row[city];
    $postcode = $row[postcode];

    $tel1 = $row[m_tel];
    $tel2 = $row[h_tel];

    $email = $row[email];

    $appt = explode("-", $row[ApptDate]);

    $appt_d = $appt[2];
    $appt_m = $appt[1];
    $appt_y = $appt[0];

    $apptT = explode(":", $row[ApptTime]);

    $appt_h = $apptT[0];
    $appt_m = $apptT[1];

    $status = $row[Status];

    $accepted = explode("-", $row['AcceptedDate']);
    $acc_D = $accepted[2];
    $acc_M = $accepted[1];
    $acc_Y = $accepted[0];

    $rejRea = $row[RejectionReason];

    $solution = $row[Solution];

    $solVal = $row[Value];

    $firstVal = $row[FirstPaymentValue];

    $addedCost = $row[AddedCost];

    $compOwed = $row[CompaniesOwed];

    $debtAmount = $row[DebtAmmount];

    $partnerDebt = $row[PartnerDebt];

    $partnerWork = $row[PartnerWork];

    $partnerBenefits = $row[PartnerBenefits];

    $firstPaymentDate = explode("-", $row[FirstPaymentDate]);

    $fp_day = $firstPaymentDate[2];
    $fp_month = $firstPaymentDate[1];
    $fp_year = $firstPaymentDate[0];
    
print<<<'HTML'
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>Edit page OBFTS</title>
        </head>

        <body>

            <div id="edit_container">


                <strong>Name</strong>
                <br />
                <form id="edit_customer" action="update.php">
                    <input name="title"/>


                    <input name="first_name"/>


                    <input name="last_name"/>

                    <br  class="clearfix"/>
                    <strong>Date of Birth </strong>
                    <br  />
                    <input name="day" value="<?php echo $dob_d; ?>" />
                    <input name="month" value="<?php echo $dob_m; ?>" />
                    <input name="year" value="<?php echo $dob_y; ?>" />

                    <br  class="clearfix"/>
                    <strong>Marital:</strong> <br  />
                    <select name="marital">
                        <option value="single" <?php if ($marital == 'single') { ?> selected="selected"<?php } ?>>Single</option>
                        <option value="divorced" <?php if ($marital == 'divorced') { ?> selected="selected"<?php } ?> >Divorced</option>
                        <option value="married" <?php if ($marital == 'married') { ?> selected="selected"<?php } ?> >Married</option>
                        <option value="together" <?php if ($marital == 'together') { ?> selected="selected"<?php } ?> >Living together</option>
                        <option value="Widowed" <?php if ($marital == 'widowed') { ?> selected="selected"<?php } ?> >Widowed</option>
                        <option value="Separated" <?php if ($marital == 'Seperated') { ?> selected="selected"<?php } ?> >Separated</option>
                    </select>
                    <br  class="clearfix"/>

                    <strong>Address:</strong> <br  />
                    <input  name="add1" value="<?php echo $add1; ?>"/><br  />
                    <input  name="add2" value="<?php echo $add2; ?>"/><br  />
                    <input  name="add3" value="<?php echo $add3; ?>"/> <br />
                    <input  name="postcode" value="<?php echo $postcode; ?>" />
                    <br class="clearfix" />

                    <strong>Telephone Numbers</strong> <br  />
                    <input name="tel1" value="<?php echo $tel1; ?>"/>
                    <input name="tel2" value="<?php echo $tel2; ?>"/>

                    <br  class="clearfix"/>
                    <strong>Email</strong><br />
                    <input name="email"  value="<?php echo $email; ?>"/> />
                    <br  />
                    <textarea name="notes" cols="50" rows="15" >Notes</textarea>

                    <br class="clearfix" />
                    <h2>Callback/Appointment Details</h2>
                    <strong>Appointment Date</strong><br />
                    <select name="appt_day">


                        <option value="">dd</option>
    <?php
    $i = 01;
    while ($i <= 31) {
        echo "<option  value=\" $i \"";
        if ($i == $appt_d) {
            echo "selected=\"selected\"";
        } echo ">$i</option>";
        $i++;
    }
    ?>
                    </select>
                    <select name="appt_month"><option  value=""></option>
                        <?php
                        $i = 01;
                        while ($i <= 12) {
                            echo "<option  value=\" $i \"";
                            if ($i == $appt_m) {
                                echo "selected=\"selected\"";
                            } echo ">$i</option>";
                            $i++;
                        }
                        ?>

                    </select>
                    <select name="appt_year"><option value="" selected="selected"></option>

                        <?php
                        $i = 2011;
                        while ($i <= 2014) {
                            echo "<option  value=\" $i \"";
                            if ($i == $appt_y) {
                                echo "selected=\"selected\"";
                            } echo ">$i</option>";
                            $i++;
                        }
                        ?>

                    </select>
                    <br class="clearfix" />


                    <strong>Appointment Time</strong><br />
                    <select name="appt_hours"><option value=""> </option>
                        <?php
                        $i = 00;
                        while ($i <= 23) {
                            echo "<option  value=\" $i \"";
                            if ($i == $appt_h) {
                                echo "selected=\"selected\"";
                            } echo ">$i</option>";
                            $i++;
                        }
                        ?>

                    </select>
                    <select name="appt_mins"><option value=""></option>


                        <?php
                        $i = 00;
                        while ($i <= 59) {
                            echo "<option  value=\" $i \"";
                            if ($i == $appt_m) {
                                echo "selected=\"selected\"";
                            } echo ">$i</option>";
                            $i++;
                        }
                        ?>

                    </select>

                    <br class="clearfix">

                        <textarea name="appt_notes" cols="50" rows="15"> </textarea>

                        <br class="clearfix" />

                        <h2>Call Details</h2>
                        <strong>Call Status </strong> <br />
                        <select name="callStatus"> 
                            <option value=""></option>
                            <option <?php if ($status == signed) { ?> selected="selected"<?php } ?>  value="signed">Signed</option>
                            <option value="cf" <?php if ($status == 'cf') { ?> selected="selected"<?php } ?> >CF</option>
                            <option value="pbo" <?php if ($status == 'pbo') { ?> selected="selected"<?php } ?> >PBO</option>
                        </select>
                        <br class="clearfix">

                            <strong>Accepted Date</strong> <br />
                            <input name="acc_day" value="<?php echo $acc_D; ?>" />
                            <input name="acc_month" value="<?php echo $acc_M; ?>" />
                            <input name="acc_year" value="<?php echo $acc_Y; ?>">

                                <br class="clearfix" />

                                <strong>Rejection reason</strong> <br />
                                <select name="rejReason"><option value=""></option>
                                    <option value="1c" <?php if ($rejRea == "1c") { ?> selected="selected"<?php } ?>>Only one creditor</option>
                                    <option value="ni" <?php if ($rejRea == "ni") { ?> selected="selected"<?php } ?>>Not interested</option>
                                    <option value="ca" <?php if ($rejRea == "ca") { ?> selected="selected"<?php } ?>>Can't afford min</option>
                                    <option value="fees" <?php if ($rejRea == "fees") { ?> selected="selected"<?php } ?>>fees</option>
                                    <option value="wcb" <?php if ($rejRea == "wcb") { ?> selected="selected"<?php } ?>>Won't change bank</option>
                                    <option value="nc" <?php if ($rejRea == "nc") { ?> selected="selected"<?php } ?>>No Contact</option>
                                    <option value="bos" <?php if ($rejRea == "bos") { ?> selected="selected"<?php } ?>>bos</option>
                                </select>

                                <br class="clearfix" />

                                <strong>Solution</strong> <br />
                                <select name="solution">
                                    <option value=""></option>
                                    <option value="dmp" <?php if ($Solution == "dmp") { ?> selected="selected"<?php } ?> >DMP</option>
                                    <option value="ppi" <?php if ($Solution == "ppi") { ?> selected="selected"<?php } ?> >PPI</option>
                                    <option value="lf" <?php if ($Solution == "lf") { ?> selected="selected"<?php } ?> >Loan Referral</option>
                                </select>

                                <br class="clearfix" />

                                <strong>Solution Value</strong> <br />
                                <input type="text" name="solutionValue" value="<?php echo $solVal; ?>" />

                                <br class="clearfix"/>


                                <strong>First Payment Value</strong> <br />
                                <input type="text" name="firstPaymentValue" value="<?php echo $firstVal; ?>" />

                                <br class="clearfix"/>

                                <strong>Added Cost</strong> <br />
                                <input type="text" name="addedCost" value="<?php echo $addedCost; ?>" />

                                <br class="clearfix"/>


                                <strong>First Payment Date</strong> <br />  
                                <input type="text" name="fp_day"  <?php if ($fp_day != "") { ?> value="dd" <?php } else { ?> value="<?php echo $fp_day; ?>"  />
                                    <input type="text" name="fp_month" <?php if ($fp_month != "") { ?> value="mm" <?php } else { ?> value="<?php echo $fp_month; ?>" />
                                        <input type="text" name="fp_month" <?php if ($fp_year != "") { ?> value="yyyy" <?php } else { ?> value="<?php echo $fp_year; ?>" />

                                            <br class="clearfix"/>

                                            <h2>Debts </h2>

                                            <strong>Debt Amount </strong><br />
                                            <select name="debtAmount">
                                                <option value="">Not Set</option>
                                                <option value="1" <?php if ($debtAmount == "1") { ?> selected="selected"<?php } ?>>under &pound;2,000</option>
                                                <option value="2"<?php if ($debtAmount == "2") { ?> selected="selected"<?php } ?>> &pound;2,000 - &pound;5,000</option>
                                                <option value="3" <?php if ($debtAmount == "3") { ?> selected="selected"<?php } ?>>&pound;5,000 - &pound;10,000</option>
                                                <option value="4" <?php if ($debtAmount == "4") { ?> selected="selected"<?php } ?>>&pound;10,000 - &pound;15,000</option>
                                                <option value="5" <?php if ($debtAmount == "5") { ?> selected="selected"<?php } ?>>&pound;15,000 - &pound;25,000</option>
                                                <option value="6" <?php if ($debtAmount == "6") { ?> selected="selected"<?php } ?>>&pound;25,000 - &pound;50,000</option>
                                                <option value="7" <?php if ($debtAmount == "7") { ?> selected="selected"<?php } ?>>&pound;50,000 - &pound;75,000</option>
                                                <option value="8" <?php if ($debtAmount == "8") { ?> selected="selected"<?php } ?>>&pound;75,000 - &pound;100,000</option>
                                                <option value="9" <?php if ($debtAmount == "9") { ?> selected="selected"<?php } ?>>&pound;100,000+</option>
                                            </select>

                                            <strong>Companies Owed </strong><br />
                                            <select name="companiesOwed">
                                                <option value="">Not Set</option>
                                                <?php
                                                $i = 00;
                                                while ($i <= 20) {
                                                    echo "<option  value=\" $i \"";
                                                    if ($i == $compOwed) {
                                                        echo "selected=\"selected\"";
                                                    } echo ">$i</option>";
                                                    $i++;
                                                }
                                                ?>

                                            </select>

                                            <strong>Partner Debt</strong><br />
                                            <select name="partnerDebt">
                                                <option value="">Not Set</option>
                                                <option value="yes" <?php if ($partnerDebt == "yes") {
                                                    echo "selected=\"selected\"";
                                                } ?>>yes</option>
                                                <option value="no" <?php if ($partnerDebt == "no") {
                                                    echo "selected=\"selected\"";
                                                } ?>>No</option> 
                                            </select>

                                            <strong>Partner Work</strong><br />
                                            <select name="partnerWork">
                                                <option value="">Not Set</option>
                                                <option value="yes" <?php if ($partnerWork == "yes") {
                                                    echo "selected=\"selected\"";
                                                } ?>>Yes</option>
                                                <option value="no" <?php if ($partnerWork == "no") {
                                                    echo "selected=\"selected\"";
                                                } ?>>No</option> 
                                            </select>

                                            <strong>Partner Benefits</strong><br />
                                            <select name="partnerBenefits">
                                                <option value="">Not Set</option>
                                                <option value="yes" <?php if ($partnerBenefits == "yes") {
                                                    echo "selected=\"selected\"";
                                                } ?>>Yes</option>
                                                <option value="no" <?php if ($partnerBenefits == "no") {
                                    echo "selected=\"selected\"";
                                } ?>>No</option> 
                                            </select>

                                            <input type="submit" value="Update">

                                                </form>


                                                </div>

                                                </body>
                                                </html>
HTML;
            } else {
                header("location:index.php");
            }
            ?>

Open in new window

0
 

Author Comment

by:Everlearner
ID: 36501380
Thanks marqusG but the php Still didn't work.

Ray, you are right there is no bnefit to copying the variables over I'm just gonna use the row array directly unless I'm going to explode them, this should clean up my code...


The error message is just Parse error and the line of code is the last line. In zend framework ide it says unexpected EOF.

Thanks for the book recommendation I will definitely buy that, although is it possible to point me to tutorial about generating the select option tags as you mention or possibly a quick example? Just because it's quite urgent and I woudn't be able to get the book by next week.

Thanks again for your help.
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 668 total points
ID: 36503444
A parse error for an unexpected end of script is often caused by a missing curly brace or a HEREDOC (or NOWDOC) block that is not closed.

Line 77 has quotes:
print<<<'HTML'

Line 359 has no quotes:
HTML;

The man page is here:
http://php.net/manual/en/language.types.string.php
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question