0

could someone help me on this..
the if else statement (bold letters) is not working..
and only the if statement is running and it seems the whole condition too

i included the whole code so that everyone can see what i want to do..

<html>
<head>
<title>Untitled Document</title>

<link rel="stylesheet" href="windowfiles/dhtmlwindow.css" type="text/css" />

<script type="text/javascript" src="windowfiles/dhtmlwindow.js"></script>

<link rel="stylesheet" href="modalfiles/modal.css" type="text/css" />
<script type="text/javascript" src="modalfiles/modal.js"></script>


<style type="text/css">
<!--
#Layer9 {
	position:absolute;
	width:124px;
	height:25px;
	z-index:1;
	left: 69px;
	top: -54px;
}
#Layer11 {
	position:absolute;
	width:200px;
	height:115px;
	z-index:2;
}
-->
</style>
</head>
<html>
<head>
<title></title>
<style type="text/css">
<!--
#Layer1 {
	position:absolute;
	width:782px;
	height:115px;
	z-index:1;
	left: 406px;
	top: 81px;
}
#Layer2 {
	position:absolute;
	width:359px;
	height:24px;
	z-index:2;
	left: 73px;
	top: -7px;
}
#Layer3 {
	position:absolute;
	width:481px;
	height:22px;
	z-index:2;
	left: 73px;
	top: 32px;
}
#Layer4 {
	position:absolute;
	width:18px;
	height:23px;
	z-index:2;
	left: 73px;
	top: 72px;
}
#Layer5 {
	position:absolute;
	width:150px;
	height:22px;
	z-index:2;
	left: 73px;
	top: 110px;
}
#Layer6 {
	position:absolute;
	width:121px;
	height:21px;
	z-index:2;
	left: 72px;
	top: 147px;
}
#Layer7 {
	position:absolute;
	width:87px;
	height:25px;
	z-index:2;
	left: 72px;
	top: 186px;
}
#Layer8 {
	position:absolute;
	width:58px;
	height:25px;
	z-index:2;
	left: 4px;
	top: 278px;
}
select {
	height: 20px;
	width: 320px;
	max-height: 20px;
}
-->
</style>
</head>
<body background="naruto_wrapper_background2.JPG">
<center><font size=6>Client Info</font></center>
<div id="Layer1">
  <form action= "educbg.php" method="post">
    <?PHP echo "Name:";?>&nbsp;
    <div id="Layer2">
      <input name="name" type="text" size="70" maxlength="50" >
    </div>
    <br>
    <br>
    <?PHP echo "Address:";?>&nbsp;
    <div id="Layer3">
      <input name="address" type="text" size="80" maxlength="100">
    </div>
    <br>
    <br>
    <?PHP echo "Tel no:";?>&nbsp;<br>
    <br>
	  <div id="Layer4">
      <input name="telno" type="text" size="7" maxlength="7">
    </div>
    <?PHP echo "Country:";?>&nbsp;
    <div id="Layer5">

      <select name="country" size="1">
<option>
<option>none
<option>Afghanistan 
<option>Albania 
<option>Algeria 
<option>American Samoa
<option>Andorra 
<option>Angola
<option>Anguilla
<option>Antarctica
<option>Antigua and Barbuda 
<option>Argentina 
<option>Armenia 
<option>Aruba 
<option>Australia 
<option>Austria 
<option>Azerbaijan
<option>Bahamas 
<option>Bahrain 
<option>Bangladesh
<option>Barbados
<option>Belarus 
<option>Belgium 
<option>Belize
<option>Benin 
<option>Bermuda 
<option>Bhutan
<option>Bolivia 
<option>Bosnia and Herzegowina
<option>Botswana
<option>Bouvet Island 
<option>Brazil
<option>British Indian Ocean Territory
<option>Brunei Darussalam 
<option>Bulgaria
<option>Burkina Faso
<option>Burundi 
<option>Cambodia
<option>Cameroon
<option>Canada
<option>Cape Verde
<option>Cayman Islands
<option>Central African Republic
<option>Chad
<option>Chile 
<option>China 
<option>Christmas Island
<option>Cocos (Keeling) Islands 
<option>Colombia
<option>Comoros 
<option>Congo 
<option>Congo, the Democratic Republic of the 
<option>Cook Islands
<option>Costa Rica
<option>Cote d'Ivoire 
<option>Croatia (Hrvatska)
<option>Cuba
<option>Cyprus
<option>Czech Republic
<option>Denmark 
<option>Djibouti
<option>Dominica
<option>Dominican Republic
<option>East Timor
<option>Ecuador 
<option>Egypt 
<option>El Salvador 
<option>Equatorial Guinea 
<option>Eritrea 
<option>Estonia 
<option>Ethiopia
<option>Falkland Islands (Malvinas) 
<option>Faroe Islands 
<option>Fiji
<option>Finland 
<option>France
<option>France, Metropolitan
<option>French Guiana 
<option>French Polynesia
<option>French Southern Territories 
<option>Gabon 
<option>Gambia
<option>Georgia 
<option>Germany 
<option>Ghana 
<option>Gibraltar 
<option>Greece
<option>Greenland 
<option>Grenada 
<option>Guadeloupe
<option>Guam
<option>Guatemala 
<option>Guinea
<option>Guinea-Bissau 
<option>Guyana
<option>Haiti 
<option>Heard and Mc Donald Islands 
<option>Holy See (Vatican City State) 
<option>Honduras
<option>Hong Kong 
<option>Hungary 
<option>Iceland 
<option>India 
<option>Indonesia 
<option>Iran (Islamic Republic of)
<option>Iraq
<option>Ireland 
<option>Israel
<option>Italy 
<option>Jamaica 
<option>Japan 
<option>Jordan
<option>Kazakhstan
<option>Kenya 
<option>Kiribati
<option>Korea, Democratic People's Republic of
<option>Korea, Republic of
<option>Kuwait
<option>Kyrgyzstan
<option>Lao People's Democratic Republic
<option>Latvia
<option>Lebanon 
<option>Lesotho 
<option>Liberia 
<option >Libyan Arab Jamahiriya
<option>Liechtenstein 
<option>Lithuania 
<option>Luxembourg
<option>Macau 
<option>Macedonia, The Former Yugoslav Republic of
<option>Madagascar
<option>Malawi
<option>Malaysia
<option>Maldives
<option>Mali
<option>Malta 
<option>Marshall Islands
<option>Martinique
<option>Mauritania
<option>Mauritius 
<option>Mayotte 
<option>Mexico
<option>Micronesia, Federated States of 
<option>Moldova, Republic of
<option>Monaco
<option>Mongolia
<option>Montserrat
<option>Morocco 
<option>Mozambique
<option>Myanmar 
<option>Namibia 
<option>Nauru 
<option>Nepal 
<option>Netherlands 
<option>Netherlands Antilles
<option>New Caledonia 
<option>New Zealand 
<option>Nicaragua 
<option>Niger 
<option>Nigeria 
<option>Niue
<option>Norfolk Island
<option>Northern Mariana Islands
<option>Norway
<option>Oman
<option>Pakistan
<option>Palau 
<option>Panama
<option>Papua New Guinea
<option>Paraguay
<option>Peru
<option>Philippines 
<option>Pitcairn
<option>Poland
<option>Portugal
<option>Puerto Rico 
<option>Qatar 
<option>Reunion 
<option>Romania 
<option>Russian Federation
<option>Rwanda
<option>Saint Kitts and Nevis 
<option>Saint LUCIA 
<option>Saint Vincent and the Grenadines
<option>Samoa 
<option>San Marino
<option>Sao Tome and Principe 
<option>Saudi Arabia
<option>Senegal 
<option>Seychelles
<option>Sierra Leone
<option>Singapore 
<option>Slovakia (Slovak Republic)
<option>Slovenia
<option>Solomon Islands 
<option>Somalia 
<option>South Africa
<option>South Georgia and the South Sandwich Islands
<option>Spain 
<option>Sri Lanka 
<option>St. Helena
<option>St. Pierre and Miquelon 
<option>Sudan 
<option>Suriname
<option>Svalbard and Jan Mayen Islands
<option>Swaziland 
<option>Sweden
<option>Switzerland 
<option>Syrian Arab Republic
<option>Taiwan, Province of China 
<option>Tajikistan
<option>Tanzania, United Republic of
<option>Thailand
<option>Togo
<option>Tokelau 
<option>Tonga 
<option>Trinidad and Tobago 
<option>Tunisia 
<option>Turkey
<option>Turkmenistan
<option>Turks and Caicos Islands
<option>Tuvalu
<option>Uganda
<option>Ukraine 
<option>United Arab Emirates
<option>United Kingdom
<option>United States 
<option>United States Minor Outlying Islands
<option>Uruguay 
<option>Uzbekistan
<option>Vanuatu 
<option>Venezuela 
<option>Viet Nam
<option>Virgin Islands (British)
<option>Virgin Islands (U.S.) 
<option>Wallis and Futuna Islands 
<option>Western Sahara
<option>Yemen 
<option>Yugoslavia
<option>Zambia
<option>Zimbabwe
      </select>
    </div>
    <br>
    <br>
    <?PHP echo "City:";?>&nbsp;
    <div id="Layer6">
      <input name="city" type="text" size="30" maxlength="30">
    </div>
    <div id="Layer7">
	  <input name="bday" type="text" size="20" maxlength="20">
    </div>
    <br>
    <br>
    <?PHP echo "Birthday:";?>&nbsp;<br>
    <br>
   
	<?PHP echo "Age:";?>&nbsp;<br>
    <br>
    <div id="Layer8">
      <div id="Layer9">
        <input name="age" type="text" size="3" maxlength="3" />
      </div>
	  
	  
	  
	  <script type="text/javascript">

function success(){
	successwindow=dhtmlmodal.open('successbox', 'div', 'modalalertdiv2', 'Untitled', 'width=350px,height=150px,left=150px,top=100px,resize=0,scrolling=0')
}


function process_app1(button){
	if (button=="yes")
		window.location.href = 'display.php';
	successwindow.hide()
}
</script>

<script type="text/javascript">

function xsuccess(){
	xsuccesswindow=dhtmlmodal.open('xsuccessbox', 'div', 'modalalertdiv', 'Untitled', 'width=350px,height=150px,left=150px,top=100px,resize=0,scrolling=0')
}


function process_app2(button){
	if (button=="yes")
	
	xsuccesswindow.hide()
}

</script>


	  
	  
[B]<?PHP
if (empty($_POST['name']) || empty($_POST['address']) || empty($_POST['telno']) || empty($_POST['country']) || empty($_POST['city']) || empty($_POST['bday']) || empty($_POST['age'])) {
	include("xsuccess.php"); }
else {
	include("success.php"); }
?>[/B]
</form>
</div>

<div id="modalalertdiv2" style="display:none;"> 
<div style="background: #F3F3F3; height: 100%; padding: 5px"> 
<center><br /><br />
<?PHP
echo("Successful Application.<br>");
?>
<br />
<form id="success"> 
<input type="button" value="Next" style="margin-right: 20px" onClick="process_app1('yes')" name="Next"/> 
</form>
</center>
</div> 
</div> 



<div id="modalalertdiv" style="display:none;"> 
<div style="background: #F3F3F3; height: 100%; padding: 5px"> 
<center><br /><br />
<?PHP
echo("Unsuccessful Application.<br>");
echo("Please complete the whole form.");
?>
<br />
<form id="xsuccess"> 
<input type="button" value="Close" style="margin-right: 20px" onClick="process_app2('yes')" name="Close"/> 
</form>
</center>
</div> 
</div> 
</body>
</html>

Edited by flyheight04: n/a

4
Contributors
10
Replies
12
Views
7 Years
Discussion Span
Last Post by MindSter
0

I'm afraid that $_POST is ALWAYS empty. You have assigned no value whatsoever for your SELECT Options. The proper syntax is:

<select>
  <option value="a">A</option>
  <option value="b">B</option>
  <option value="c">C</option>
</select>

Here's a list of countries with all values assigned

<select name="country">
<option value=""></option>
<option value="Afghanistan">Afghanistan</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>
<option value="Antarctica">Antarctica</option>
<option value="Antigua and Barbuda">Antigua and Barbuda</option>
<option value="Argentina">Argentina</option>
<option value="Armenia">Armenia</option>
<option value="Australia">Australia</option>
<option value="Austria">Austria</option>
<option value="Azerbaijan">Azerbaijan</option>
<option value="Bahamas">Bahamas</option>
<option value="Bahrain">Bahrain</option>
<option value="Bangladesh">Bangladesh</option>
<option value="Barbados">Barbados</option>
<option value="Belarus">Belarus</option>
<option value="Belgium">Belgium</option>
<option value="Belize">Belize</option>
<option value="Benin">Benin</option>
<option value="Bermuda">Bermuda</option>
<option value="Bhutan">Bhutan</option>
<option value="Bolivia">Bolivia</option>
<option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option>
<option value="Botswana">Botswana</option>
<option value="Brazil">Brazil</option>
<option value="Brunei">Brunei</option>
<option value="Bulgaria">Bulgaria</option>
<option value="Burkina Faso">Burkina Faso</option>
<option value="Burma">Burma</option>
<option value="Burundi">Burundi</option>
<option value="Cambodia">Cambodia</option>
<option value="Cameroon">Cameroon</option>
<option value="Canada">Canada</option>
<option value="Cape Verde">Cape Verde</option>
<option value="Central African Republic">Central African Republic</option>
<option value="Chad">Chad</option>
<option value="Chile">Chile</option>
<option value="China">China</option>
<option value="Colombia">Colombia</option>
<option value="Comoros">Comoros</option>
<option value="Congo, Democratic Republic">Congo, Democratic Republic</option>
<option value="Congo, Republic of the">Congo, Republic of the</option>
<option value="Costa Rica">Costa Rica</option>
<option value="Cote d'Ivoire">Cote d'Ivoire</option>
<option value="Croatia">Croatia</option>
<option value="Cuba">Cuba</option>
<option value="Cyprus">Cyprus</option>
<option value="Czech Republic">Czech Republic</option>
<option value="Denmark">Denmark</option>
<option value="Djibouti">Djibouti</option>
<option value="Dominica">Dominica</option>
<option value="Dominican Republic">Dominican Republic</option>
<option value="East Timor">East Timor</option>
<option value="Ecuador">Ecuador</option>
<option value="Egypt">Egypt</option>
<option value="El Salvador">El Salvador</option>
<option value="Equatorial Guinea">Equatorial Guinea</option>
<option value="Eritrea">Eritrea</option>
<option value="Estonia">Estonia</option>
<option value="Ethiopia">Ethiopia</option>
<option value="Fiji">Fiji</option>
<option value="Finland">Finland</option>
<option value="France">France</option>
<option value="Gabon">Gabon</option>
<option value="Gambia">Gambia</option>
<option value="Georgia">Georgia</option>
<option value="Germany">Germany</option>
<option value="Ghana">Ghana</option>
<option value="Greece">Greece</option>
<option value="Greenland">Greenland</option>
<option value="Grenada">Grenada</option>
<option value="Guatemala">Guatemala</option>
<option value="Guinea">Guinea</option>
<option value="Guinea-Bissau">Guinea-Bissau</option>
<option value="Guyana">Guyana</option>
<option value="Haiti">Haiti</option>
<option value="Honduras">Honduras</option>
<option value="Hong Kong">Hong Kong</option>
<option value="Hungary">Hungary</option>
<option value="Iceland">Iceland</option>
<option value="India">India</option>
<option value="Indonesia">Indonesia</option>
<option value="Iran">Iran</option>
<option value="Iraq">Iraq</option>
<option value="Ireland">Ireland</option>
<option value="Israel">Israel</option>
<option value="Italy">Italy</option>
<option value="Jamaica">Jamaica</option>
<option value="Japan">Japan</option>
<option value="Jordan">Jordan</option>
<option value="Kazakhstan">Kazakhstan</option>
<option value="Kenya">Kenya</option>
<option value="Kiribati">Kiribati</option>
<option value="Korea, North">Korea, North</option>
<option value="Korea, South">Korea, South</option>
<option value="Kuwait">Kuwait</option>
<option value="Kyrgyzstan">Kyrgyzstan</option>
<option value="Laos">Laos</option>
<option value="Latvia">Latvia</option>
<option value="Lebanon">Lebanon</option>
<option value="Lesotho">Lesotho</option>
<option value="Liberia">Liberia</option>
<option value="Libya">Libya</option>
<option value="Liechtenstein">Liechtenstein</option>
<option value="Lithuania">Lithuania</option>
<option value="Luxembourg">Luxembourg</option>
<option value="Macedonia">Macedonia</option>
<option value="Madagascar">Madagascar</option>
<option value="Malawi">Malawi</option>
<option value="Malaysia">Malaysia</option>
<option value="Maldives">Maldives</option>
<option value="Mali">Mali</option>
<option value="Malta">Malta</option>
<option value="Marshall Islands">Marshall Islands</option>
<option value="Mauritania">Mauritania</option>
<option value="Mauritius">Mauritius</option>
<option value="Mexico">Mexico</option>
<option value="Micronesia">Micronesia</option>
<option value="Moldova">Moldova</option>
<option value="Mongolia">Mongolia</option>
<option value="Morocco">Morocco</option>
<option value="Monaco">Monaco</option>
<option value="Mozambique">Mozambique</option>
<option value="Namibia">Namibia</option>
<option value="Nauru">Nauru</option>
<option value="Nepal">Nepal</option>
<option value="Netherlands">Netherlands</option>
<option value="New Zealand">New Zealand</option>
<option value="Nicaragua">Nicaragua</option>
<option value="Niger">Niger</option>
<option value="Nigeria">Nigeria</option>
<option value="Norway">Norway</option>
<option value="Oman">Oman</option>
<option value="Pakistan">Pakistan</option>
<option value="Panama">Panama</option>
<option value="Papua New Guinea">Papua New Guinea</option>
<option value="Paraguay">Paraguay</option>
<option value="Peru">Peru</option>
<option value="Philippines">Philippines</option>
<option value="Poland">Poland</option>
<option value="Portugal">Portugal</option>
<option value="Qatar">Qatar</option>
<option value="Romania">Romania</option>
<option value="Russia">Russia</option>
<option value="Rwanda">Rwanda</option>
<option value="Samoa">Samoa</option>
<option value="San Marino">San Marino</option>
<option value=" Sao Tome"> Sao Tome</option>
<option value="Saudi Arabia">Saudi Arabia</option>
<option value="Senegal">Senegal</option>
<option value="Serbia and Montenegro">Serbia and Montenegro</option>
<option value="Seychelles">Seychelles</option>
<option value="Sierra Leone">Sierra Leone</option>
<option value="Singapore">Singapore</option>
<option value="Slovakia">Slovakia</option>
<option value="Slovenia">Slovenia</option>
<option value="Solomon Islands">Solomon Islands</option>
<option value="Somalia">Somalia</option>
<option value="South Africa">South Africa</option>
<option value="Spain">Spain</option>
<option value="Sri Lanka">Sri Lanka</option>
<option value="Sudan">Sudan</option>
<option value="Suriname">Suriname</option>
<option value="Swaziland">Swaziland</option>
<option value="Sweden">Sweden</option>
<option value="Switzerland">Switzerland</option>
<option value="Syria">Syria</option>
<option value="Taiwan">Taiwan</option>
<option value="Tajikistan">Tajikistan</option>
<option value="Tanzania">Tanzania</option>
<option value="Thailand">Thailand</option>
<option value="Togo">Togo</option>
<option value="Tonga">Tonga</option>
<option value="Trinidad and Tobago">Trinidad and Tobago</option>
<option value="Tunisia">Tunisia</option>
<option value="Turkey">Turkey</option>
<option value="Turkmenistan">Turkmenistan</option>
<option value="Uganda">Uganda</option>
<option value="Ukraine">Ukraine</option>
<option value="United Arab Emirates">United Arab Emirates</option>
<option value="United Kingdom">United Kingdom</option>
<option value="United States">United States</option>
<option value="Uruguay">Uruguay</option>
<option value="Uzbekistan">Uzbekistan</option>
<option value="Vanuatu">Vanuatu</option>
<option value="Venezuela">Venezuela</option>
<option value="Vietnam">Vietnam</option>
<option value="Yemen">Yemen</option>
<option value="Zambia">Zambia</option>
<option value="Zimbabwe">Zimbabwe</option>
</select>
0

I think the function you are trying to call is isset not empty

?php
// If the form has been submitted with a supplied keyword
if (isset($_POST)) {

0

are you getting any errors

i didn't get any errors.
its just that the if else condition it not working..

0

^oh i forgot, thanks for that

try what MindSter suggest. That should be able to fix your problem.

0

i've already changed what MindSter suggested..the form data can now be displayed on the display.php page..but am i right with the include () syntax?? as if the only first include() works

i've tried what ApocDen said..the else statement is not working

Edited by flyheight04: n/a

0

what could be the right condition for this??.

<?PHP
if (empty($_POST['name']) || empty($_POST['address']) || empty($_POST['telno']) || empty($_POST['country']) || empty($_POST['city']) || empty($_POST['bday']) || empty($_POST['age'])) {
	include("xsuccess.php"); }
else {
	include("success.php"); }
?>

i think there is something wrong with my condition..because on my form

<form action="display.php" method="post"></form>

if i'm not mistaken the form data is sent to display.php so the $_POST will not work on the current page??

0

So the orginal problem was solved ?
There's nothing wrong with that conditiion ... but you could change the empty($stuff) to $stuff==0 (or NULL).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.