Reply to Re: conditional

Your name:

Reply:


Posted by Art on 04/24/07 11:50

Here's the full code: There is a little homegrown java and some java from a
3rd party vendor in the code. The comment about bad code is no doubt what
the problem is, I just don't see where the code is bad.

Thanks Art

Basically what happens, if the variable $hold_chk =1 it should post back to
itself, otherwise it should post to the other form.


<?php

$len_fname = $_POST['len_fname'];
$len_lname = $_POST['len_lname'];
$len_mortgage_co = $_POST['len_mortgage_co'];
$len_add = $_POST['len_add'];
$len_city = $_POST['len_city'];
$len_state = $_POST['len_state'];
$len_zip = $_POST['len_zip'];
$len_phone = $_POST['len_phone'];
$len_fax = $_POST['len_fax'];
$len_email = $_POST['len_email'];
$app_fname = $_POST['app_fname'];
$app_lname = $_POST['app_lname'];
$app_add = $_POST['app_add'];
$app_city = $_POST['app_city'];
$app_zip = $_POST['app_zip'];
$app_owners_ph = $_POST['app_owners_ph'];
$prop_add = $_POST['prop_add'];
$prop_city = $_POST['prop_city'];
$prop_state = $_POST['prop_state'];
$prop_zip = $_POST['prop_zip'];
$prop_county = $_POST['prop_county'];
$date_due = $_POST['date_due'];


$app_buyers_ph = $_POST['app_buyers_ph'];
$detached = $_POST['detached'];
$prime_res = $_POST['prime_res'];
$conven = $_POST['conven'];
$first_mort = $_POST['first_mort'];
$purchase = $_POST['purchase'];
$attached = $_POST['attached'];
$second_home = $_POST['second_home'];
$fha = $_POST['fha'];
$second_mort = $_POST['second_mort'];
$cash_out_refi = $_POST['cash_out_refi'];
$condo = $_POST['condo'];
$invest_prop = $_POST['invest_prop'];
$va = $_POST['va'];
$no_cash_out_refi = $_POST['no_cash_out_refi'];
$pud = $_POST['pud'];
$usda_rural = $_POST['usda_rural'];
$coop = $_POST['coop'];
$sale_price = $_POST['sale_price'];
$est_val = $_POST['est_val'];
$loan_amt = $_POST['loan_amt'];
$leg_desc = $_POST['leg_desc'];
$list_sell_agent = $_POST['list_sell_agent'];
$int_ext_full = $_POST['int_ext_full'];
$ext_only = $_POST['ext_only'];
$market_rent = $_POST['market_rent'];
$comments = $_POST['comments'];
//echo "<br><br><br>";
//echo $prop_add;
$holdchk = 0;

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

echo "<br><br><br>";
if (empty($_POST['app_fname'])) {
$holdchk = 1;
echo "Applicants first name cannot be blank";
echo "<br>";
}

if (empty($_POST['app_lname'])) {
$holdchk = 1;
echo "Applicants last name cannot be blank";
echo "<br>";
}

if (empty($_POST['app_add'])) {
$holdchk = 1;
echo "Applicants address cannot be blank";
echo "<br>";
}

if (empty($_POST['app_city'])) {
$holdchk = 1;
echo "Applicants city cannot be blank";
echo "<br>";
}

if (empty($_POST['app_zip'])) {
$holdchk = 1;
echo "Applicants zip code cannot be blank";
echo "<br>";
}

if (empty($_POST['app_owners_ph'])) {
$holdchk = 1;
echo "Applicants owners phone number cannont be blank";
echo "<br>";
}

if (empty($_POST['len_fname'])) {
$holdchk = 1;

echo "Lenders first name cannot be blank";
echo "<br>";
}

if (empty($_POST['len_lname'])) {
$holdchk = 1;
echo "Lenders last name cannot be blank";
echo "<br>";
}

if (empty($_POST['len_mortgage_co'])) {
$holdchk = 1;
echo "Mortgage company name cannot be blank";
echo "<br>";
}

if (empty($_POST['len_add'])) {
$holdchk = 1;
echo "Lenders address cannot be blank";
echo "<br>";
}

if (empty( $_POST['len_city'])) {
$holdchk = 1;
echo "Lenders city cannot be blank";
echo "<br>";
}

if (empty($_POST['len_state'])) {
$holdchk = 1;
echo "Lenders state cannot be blank";
echo "<br>";
}

if (empty( $_POST['len_zip'])) {
$holdchk = 1;
echo "Lenders zip code cannot be blank";
echo "<br>";
}

if (empty($_POST['len_phone'])) {
$holdchk = 1;
echo "Lenders phone number cannot be blank";
echo "<br>";
}

if (empty($_POST['len_fax'])) {
$holdchk = 1;
echo "Lenders fax number cannot be blank";
echo "<br>";
}

if (empty($_POST['len_email'])) {
$holdchk = 1;
echo "Lenders email cannot be blank";
echo "<br>";
}

if (empty($_POST['prop_add'])) {
$holdchk = 1;
echo "Property address cannot be blank";
echo "<br>";
}

if (empty($_POST['prop_city'])) {
$holdchk = 1;
echo "Property city cannot be blank";
echo "<br>";
}

if (empty($_POST['prop_state'])) {
$holdchk = 1;
echo "Property state cannot be blank";
echo "<br>";
}

if (empty($_POST['prop_zip'])) {
$holdchk = 1;
echo "Property zip code cannot be blank";
echo "<br>";
}

if (empty($_POST['prop_county'])) {
$holdchk = 1;
echo "Property county cannot be blank";
echo "<br>";
}

if (empty($_POST['date_due'])) {
$holdchk = 1;
echo "Please enter a valid appraisal due date";
echo "<br>";
}



if ($holdchk == 0 ){
echo "<form method=\"POST\" action=\"something.php\">";

}



}

?>
<html>

<head>
<LINK href="fairmark.css" rel="stylesheet" type="text/css">


<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Fair Market Request an Appraisal</title>
</head>

<body link="#000000" vlink="#000000" alink="#000000">
<!-- DO NOT MOVE! The following AllWebMenus linking code section must always
be placed
right AFTER the BODY tag-->
<!-- ******** BEGIN ALLWEBMENUS CODE FOR menu ******** -->
<script type="text/javascript">var MenuLinkedBy="AllWebMenus
[4]",awmMenuName="menu",awmBN="646";awmAltUrl="";</script><script
charset="UTF-8"
src="menu.js" type="text/javascript"></script><script
type="text/javascript">awmBuildMenu();</script>
<!-- ******** END ALLWEBMENUS CODE FOR menu ******** -->


<form method="POST" action="thisform.php">

<p align="center">&nbsp;</p>
<p align="center"><font size="5" face="Arial, Helvetica,
sans-serif">Request
an
Appraisal</font></p>
<div style="position: absolute; width: 160px; height: 40px; z-index: 1;
left: 682px; top:
110px" id="layer1">
<p align="center"><font face="Arial, Helvetica, sans-serif">Today's
Date<br>
&nbsp;
<script type="text/javascript">

var d=new Date()
var day=d.getDate()
var month=d.getMonth() + 1
var year=d.getFullYear()
var fulldate = year + "-" + month + "-" + day
document.write(month + "/" + day + "/" + year)



</script>

</font></div>
<table border="0" width="85%" id="table13">
<tr>
<td align="center" width="405">
<p align="left"><b><font face="Arial, Helvetica, sans-serif">Fair
Market
Appraisals, LLC
<br>
P.O. Box 312298<br>
Atlanta, GA 31131<br>
(P) 404-474-8281 <br>
(F) 404-506-9847</font></b><p align="left">
<br>
&nbsp;

</td>
<td align="center" valign="top">
<p align="left">


<img border="0" src="final_logo5.gif" width="216" height="198"></td>
</tr>
<tr>
<td align="center" width="405">
<p align="left">
<font face="Arial, Helvetica, sans-serif">Applicant</font><p
align="left">
&nbsp;</td>
<td align="center" valign="top">
<p align="left">
<font face="Arial, Helvetica, sans-serif">Lender</font></td>
</tr>
<tr>
<td align="center" width="405" valign="top">
<p align="left"><font face="Arial, Helvetica, sans-serif">
<input type="text" name="app_fname" value="<?print $app_fname;
?>"< size="30">
First Name <br>
<input type="text" name="app_lname" value="<?print $app_lname;
?>"< size="35">
Last Name <br>

<input type="text" name="app_add" value="<?print $app_add; ?>"<
size="35">
Address<br>
<input type="text" name="app_city" value="<?print $app_city;
?>"< size="35">
City <br>
<input type="text" name="app_zip" value="<?print $app_zip; ?>"<
size="35">
ZipCode<br>
<input type="text" name="app_owners_ph" value="<?print
$app_owners_ph; ?>"<
size="35">
Owners phone #<br>
<input type="text" name="app_buyers_ph" value="<?print
$app_buyers_ph; ?>"<
size="35">
Buyers phone #</font></td>

<td align="center" >
<p align="left"><font face="Arial, Helvetica, sans-serif">
<input type="text" name="len_fname" value="<?print $len_fname;
?>"< size="35">
First Name<br>
<input type="text" name="len_lname" value="<?print $len_lname;
?>" <size="35">
Last Name <br>
<input type="text" name="len_mortgage_co" value="<?print
$len_mortgage_co; ?>"
<size="33">
Mortgage Co. <br>
<input type="text" name="len_title" value="<?print $len_title; ?>"
<size="33"> Title<br>
<input type="text" name="len_add" value="<?print $len_add; ?>"
<size="42">
Address <br>
<input type="text" name="len_city" value="<?print $len_city;
?>" <size="42">
City <br>
<input type="text" name="len_state" value="<?print $len_state;
?>" <size="7">
State <br>
<input type="text" name="len_zip" value="<?print $len_zip; ?>">
ZipCode<br>
<input type="text" name="len_phone" value="<?print $len_phone;
?>" <size="26">
(P)
</font><br>
<font face="Arial, Helvetica, sans-serif">
<input type="text" name="len_fax" value="<?print $len_fax; ?>"
<size="26">
(F) <br>
<input type="text" name="len_email" value="<?print $len_email;
?>" <size="26">
Email</font></td>
</tr>
</table>
<p align="center"><font face="Arial, Helvetica, sans-serif"
size="5">Property and Mortgage
Information</font></p>
<table width="81%" border="0" id="table14">
<tr>
<td width="12%"><font face="Arial, Helvetica, sans-serif" size="2">
Property Type</font></td>
<td width="19%"><font face="Arial, Helvetica, sans-serif" size="2">
Occupancy Status</font></td>
<td width="25%"><font face="Arial, Helvetica, sans-serif"
size="2">Type of
Loan</font></td>
<td width="13%"><font face="Arial, Helvetica, sans-serif"
size="2">Lien
Position</font></td>
<td width="21%"><font face="Arial, Helvetica, sans-serif"
size="2">Loan
Purpose</font></td>
</tr>
<tr>
<td width="12%" align="left">



<input type="checkbox" name="detached" <?php if($detached ==
"1"){echo "
CHECKED";}?> value="1"><font size="2">
</font><font size="2" face="Arial, Helvetica,
sans-serif">Detached</font></td>
<td width="19%" align="left"><font face="Arial, Helvetica,
sans-serif">
<input type="checkbox" name="prime_res" <?php if($prime_res ==
"1"){echo "
CHECKED";}?> value="1"><font size="2">
Primary Residence</font></font></td>
<td width="25%" align="left"><font face="Arial, Helvetica,
sans-serif">
<input type="checkbox" name="conven" <?php if($conven == "1"){echo "
CHECKED";}?>
value="1"><font size="2">
Conventional</font></font></td>
<td width="13%" align="left"><font face="Arial, Helvetica,
sans-serif">
<input type="checkbox" name="first_mort" <?php if($first_mort ==
"1"){echo "
CHECKED";}?> value="1"><font size="2">
1st Mortgage</font></font></td>
<td width="21%" align="left"><font face="Arial, Helvetica,
sans-serif">
<input type="checkbox" name="purchase" <?php if($purchase ==
"1"){echo "
CHECKED";}?> value="1"><font size="2">
Purchase</font></font></td>
</tr>
<tr>
<td width="12%" align="left"><font face="Arial, Helvetica,
sans-serif">
<input type="checkbox" name="attached" <?php if($attached ==
"1"){echo "
CHECKED";}?> value="1"><font size="2">
Attached</font></font></td>
<td width="19%" align="left"><font face="Arial, Helvetica,
sans-serif">
<input type="checkbox" name="second_home" <?php if($second_home ==
"1"){echo "
CHECKED";}?> value="1"><font size="2">
Second Home</font></font></td>
<td width="25%" align="left"><font face="Arial, Helvetica,
sans-serif">
<input type="checkbox" name="fha" <?php if($fha == "1"){echo "
CHECKED";}?>
value="1"><font size="2">
FHA</font></font></td>
<td width="13%" align="left"><font face="Arial, Helvetica,
sans-serif">
<input type="checkbox" name="second_mort" <?php if($second_mort ==
"1"){echo "
CHECKED";}?> value="1"><font size="2">
2nd Mortgage</font></font></td>
<td width="21%" align="left"><font face="Arial, Helvetica,
sans-serif">
<input type="checkbox" name="cash_out_refi" <?php if($cash_out_refi
== "1"){echo "
CHECKED";}?> value="1"><font size="2">
Cash out Refi </font> </font></td>
</tr>
<tr>
<td width="12%" align="left"><font face="Arial, Helvetica,
sans-serif">
<input type="checkbox" name="condo" <?php if($condo == "1"){echo "
CHECKED";}?>
value="1"><font size="2">
Condo</font></font></td>
<td width="19%" align="left"><font face="Arial, Helvetica,
sans-serif">
<input type="checkbox" name="invest_prop" <?php if($invest_prop ==
"1"){echo "
CHECKED";}?> value="1"><font size="2">
Investment Property</font></font></td>
<td width="25%" align="left"><font face="Arial, Helvetica,
sans-serif">
<input type="checkbox" name="va" <?php if($va == "1"){echo "
CHECKED";}?>
value="1"><font size="2">
VA</font></font></td>
<td width="13%" align="left"><font size="2">&nbsp;</font></td>
<td width="21%" align="left"><font face="Arial, Helvetica,
sans-serif">
<input type="checkbox" name="no_cash_out_refi" <?php
if($no_cash_out_refi == "1"){echo
" CHECKED";}?> value="1"><font size="2">
No cash out Refi </font> </font></td>
</tr>
<tr>
<td width="12%" align="left"><font face="Arial, Helvetica,
sans-serif">
<input type="checkbox" name="pud" <?php if($pud == "1"){echo "
CHECKED";}?>
value="1"><font size="2">
PUD</font></font></td>
<td width="19%" align="left"><font size="2">&nbsp;</font></td>
<td width="25%" align="left">
<input type="checkbox" name="usda_rural" <?php if($usda_rural ==
"1"){echo "
CHECKED";}?> value="1"><font size="2">
<font face="Arial, Helvetica, sans-serif">USDA /Rural</font> </font>
<font size="2" face="Arial, Helvetica, sans-serif">Housing
Service</font></td>
<td width="13%" align="left"><font size="2">&nbsp;</font></td>
<td width="21%" align="left"><font size="2">&nbsp;</font></td>
</tr>
<tr>
<td width="12%" align="left"><font face="Arial, Helvetica,
sans-serif">
<input type="checkbox" name="coop" <?php if($coop == "1"){echo "
CHECKED";}?>
value="1"><font size="2">
CO-OP</font></font></td>
<td width="19%" align="left"><font size="2">&nbsp;</font></td>
<td width="25%" align="left"><font size="2">&nbsp;</font></td>
<td width="13%" align="left"><font size="2">&nbsp;</font></td>
<td width="21%" align="left"><font size="2">&nbsp;</font></td>
</tr>
</table>
<table border="0" width="81%" id="table15">
<tr>Note: DO NOT USE $ SIGNS WHEN INPUTING DOLLAR AMOUNTS<br><br>
<td width="246"><font face="Arial, Helvetica, sans-serif">
<font size="2">Sale Price </font>
<input type="text" name="sale_price" value="<?print
"$sale_price"; ?>"
<size="20"></font></td>
<td width="268"><font face="Arial, Helvetica, sans-serif">
<font size="2">Estimated Value </font>
<input type="text" name="est_val" value="<?print "$est_val";
?>"
<size="20"></font></td>
<td width="0"><font face="Arial, Helvetica, sans-serif">
<font size="2">Loan Amount&nbsp; </font>
<input type="text" name="loan_amt" value="<?print "$loan_amt";
?>"
<size="20"></font></td>
</tr>
<tr>
<td width="246"><font size="2" face="Arial, Helvetica, sans-serif"><br>
Property Address:<br>
</font><font face="Arial, Helvetica, sans-serif">
<input type="text" name="prop_add" value="<?print $prop_add;
?>" <size="42">
<font size="2">Address<br>
<input type="text" name="prop_city" value="<?print $prop_city;
?>" <size="33">
City<br>
<input type="text" name="prop_state" value="<?print $prop_state;
?>" <size="33">
State<br>
<input type="text" name="prop_zip" value="<?print $prop_zip; ?>"
<size="33">
Zip<br>
<input type="text" name="prop_county" value="<?print
$prop_county; ?>" <size="33">
County</font></font></td>
<td width="268" valign="top"><br>
<font size="2" face="Arial, Helvetica, sans-serif">Legal Description:<br>
</font><textarea rows="7" name="leg_desc" cols="31"><?php echo
$leg_desc; ?></textarea></td>
<td width="0" valign="top"><br>
<font size="2" face="Arial, Helvetica, sans-serif">Listing/Selling
Agent:<br>
</font><font face="Arial, Helvetica, sans-serif">
<input type="text" name="list_sell_agent" value="<?print
$list_sell_agent; ?>"
<size="33"></font></td>
</tr>
</table>
<p align="center"><font face="Arial, Helvetica, sans-serif"
size="5">Appraisal
Information</font></p>
<table border="0" width="81%" id="table16">
<tr>
<td colspan="4"><font face="Arial, Helvetica, sans-serif" size="2">
Use this format for entering due date:&nbsp; YYYY-MM-DD<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Date Due: <input type="text" name="date_due" value="<?print
$date_due; ?>" size="13"></font></td>
</tr>
<tr>
<td colspan="4">
<p align="center">
<font size="2" face="Arial, Helvetica, sans-serif">Type of
Appraisal</font></td>
</tr>
<tr>
<td width="29%" valign="top">
<input type="checkbox" name="int_ext_full" <?php if($int_ext_full ==
"1"){echo "
CHECKED";}?> value="1">
<font face="Arial, Helvetica, sans-serif" size="2">Interior /
Exterior (Full)</font></td>
<td colspan="2" valign="top">
<input type="checkbox" name="ext_only" <?php if($ext_only ==
"1"){echo "
CHECKED";}?> value="1">
<font face="Arial, Helvetica, sans-serif" size="2">Exterior
Only</font></td>
<td width="39%" valign="top">
<input type="checkbox" name="market_rent" <?php if($market_rent ==
"1"){echo "
CHECKED";}?> value="1">
<font face="Arial, Helvetica, sans-serif" size="2">Market Rent
Analysis<br>
<br>
&nbsp;</font></td>
</tr>
<tr>
<td colspan="2" valign="top">
<p align="left"><font face="Arial, Helvetica, sans-serif"
size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Comments:</font></td>
<td colspan="2" valign="top"><textarea rows="7"
name="comments" cols="31"><?php echo $comments; ?></textarea></td>
</tr>
</table>
<p align="center"><b><font face="Arial, Helvetica, sans-serif"
size="2">When
you complete your application, please hit the submit button</font></b>
<input
type="submit" value="Submit" name="B1"></p>
</form>

<p align="center"><font face="Arial Rounded MT Bold">
<a href="mailto:something">
something@something .comiz</a></font></p>
<p align="center"><font face="Arial Rounded MT Bold" size="1">designed by
<a href="http://www.something.com">www.something.com</a></font></p>

</body>

</html>




"Christoph Burschka" <christoph.burschka@rwth-aachen.de> wrote in message
news:595p23Ftrns8U1@mid.dfncis.de...
> Geoff Berrow schrieb:
>> Message-ID: <IffXh.124$F11.40@bignews1.bellsouth.net> from Art contained
>> the following:
>>
>>
>>>I'm trying to use a conditional statement for posting a form with php.
>>>The problem i'm having is everytime I hit the submit button, i have to
>>>hit it a second time to get the form to post. I've checked the variable
>>>$holdchk and see that it's coming back as "0". Has anyone experienced
>>>this problem?
>>
>>
>> Try
>>
>> <?php
>>
>> if ($holdchk == 1 ){
>> echo "<form method=\"POST\" action=\"otherform.php\">";
>> }
>> else{
>> echo "<form method=\"POST\" action=\"someform.php\">";
>> }
>>
>> ?>
>
> Yes, that's cleaner, but technically there's no reason why the two if's
> shouldn't work the same way (at least for values 1 or 0 - the if-else of
> course will do the "0" action for all values not equal to one).
>
> However, the problem - having to click twice to get it to submit - is a
> browser-side problem. It could be related to messy HTML code or broken
> Javascript. But there's no way to tell without seeing the whole form.
>
> --
> cb

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация