Solved

else statement help needed

Posted on 2009-05-05
3
238 Views
Last Modified: 2012-05-06
hello. i am confused as to why this statement is not including the file 'formvars.php' and always going to 'transform.php' no matter what way round i put it. Var_dump shows me that the string is being passed "Vehicle Transport" which is correct but if another string say "hello" is passed it should go to 'formvars.php'. any help gratefully received. many thanks
<?php  

if (empty($prez)) { echo $error_job; } 

elseif (isset($_POST['Intext'])=="Vehicle Transport") 

{ echo $stage2_msg; include 'transform.php'; } 

else {  echo $stage2_msg; include 'formvars.php'; }

 ?>

Open in new window

0
Comment
Question by:peter_coop
3 Comments
 
LVL 8

Accepted Solution

by:
mostart earned 500 total points
Comment Utility
try like this:


<?php  

if (empty($prez)) { echo $error_job; } 

elseif (isset($_POST['Intext']) && $_POST['Intext'] =="Vehicle Transport") 

{ echo $stage2_msg; include 'transform.php'; } 

else {  echo $stage2_msg; include 'formvars.php'; }

?>

Open in new window

0
 
LVL 4

Expert Comment

by:bljak
Comment Utility
Because your "elseif" statement ist wrong.
It should be rather something like piece of code below.
<?php  

if ( empty($prez) )

{

	echo $error_job;

}

elseif ( isset($_POST['Intext']) && $_POST['Intext'] == "Vehicle Transport" )

{

	echo $stage2_msg;

	include "transform.php";

} 

else

{

	echo $stage2_msg;

	include "formvars.php";

}

?>

Open in new window

0
 

Author Closing Comment

by:peter_coop
Comment Utility
excellent. couldn't see for looking :-) thanks very much
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now