Jump to content


Photo

Cases Issue


  • Please log in to reply
4 replies to this topic

#1 Guteman

Guteman
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts
  • LocationWisconsin

Posted 05 August 2006 - 07:28 PM

Hey,

Another problem with my coding. I coded this without the cases and it worked, but when I added in the cased the error messages and echos do not work. Can somebody help?

<?php

switch($_GET['project'])
{
	case 'createproject':
			?>
			<div style="text-align: right; margin: 0 10px 0 0;">Create a New Project</div>
			
			<?php
		if(isset($_POST['newproject']))
		{
		$login = $_POST['client'];
		
		$checkclient = mysql_query("SELECT * FROM users") or die ("MySQL Error");
		$checkclient = mysql_fetch_array($checkclient);
		
		
			if(strlen($_POST['client']) <= 0)
			{
			$error_message .= '<p class="failure">Error: You did not enter a Client Name.</p>';
			}
			
			elseif($_POST['client'] != $checkclient['login'])
			{
			$error_message .= '<p class="failure">Error: Client Login Name not found.</p>';
			}
			
			if(isset($error_message))
			{
			echo("$error_message");
			}
			
			if(!isset($error_message))
			{
			$client = htmlspecialchars($_POST['client']);
			$name = htmlspecialchars($_POST['name']);
			$domain = htmlspecialchars($_POST['domain']);
			$designer = htmlspecialchars($_POST['designer']);
			$developer = htmlspecialchars($_POST['developer']);
			$deadline = htmlspecialchars($_POST['deadline']);
			$webhosting = htmlspecialchars($_POST['webhosting']);
			$projecturl = htmlspecialchars($_POST['projecturl']);
			$budget = htmlspecialchars($_POST['budget']);
			$phase = htmlspecialchars($_POST['phase']);
			$status = htmlspecialchars($_POST['status']);
			
			$query = mysql_query("INSERT INTO projects (client, name, domain, designer, developer, deadline, webhosting, projecturl, budget, phase, status) VALUES('$client','$name','$domain','$designer','$developer','$deadline','$webhosting','$projecturl','$budget','$phase','$status')") or die ("MySQL Error");
			
			echo("<meta http-equiv=\"Refresh\" content=\"2; URL=index.php\" />Project Successfully Created! Redirecting....");
			}
		}
		?>
<table cellspacing="0" cellpadding="0" style="margin: 10px 0 0 0;">
<form method="post" action="<?php echo $PHP_SELF; ?>">
<tr><td>Client:&nbsp;</td><td><input type="text" name="client" value="<?php if (isset($_POST['client'])) echo $_POST['client']; ?>" size="40" maxlength="40" /></td></tr>
<tr><td>Project Name:&nbsp;</td><td><input type="text" name="name" value="<?php if (isset($_POST['name'])) echo $_POST['name']; ?>" size="40" maxlength="40" /></td></tr>
<tr><td>Project Domain:&nbsp;</td><td><input type="text" name="domain" value="<?php if (isset($_POST['domain'])) echo $_POST['domain']; ?>" size="40" maxlength="40" /></td></tr>
<tr><td>Project Designer:&nbsp;</td><td><input type="text" name="designer" value="<?php if (isset($_POST['designer'])) echo $_POST['designer']; ?>" size="40" maxlength="40" /></td></tr>
<tr><td>Project Developer:&nbsp;</td><td><input type="text" name="developer" value="<?php if (isset($_POST['developer'])) echo $_POST['developer']; ?>" size="40" maxlength="40" /></td></tr>
<tr><td>Deadline:&nbsp;</td><td><input type="text" name="deadline" value="<?php if (isset($_POST['deadline'])) echo $_POST['deadline']; ?>" size="40" maxlength="40" /></td></tr>
<tr><td>Project URL:&nbsp;</td><td><input type="text" name="projecturl" value="<?php if (isset($_POST['projecturl'])) echo $_POST['projecturl']; ?>" size="40" maxlength="40" /></td></tr>
<tr><td>Project Status:&nbsp;</td><td><input type="text" name="status" value="<?php if (isset($_POST['status'])) echo $_POST['status']; ?>" size="40" maxlength="40" /></td></tr>
<tr><td style="padding: 2px 0 0 0;">Webhosting Needed?&nbsp;</td><td style="padding: 2px 0 0 0;"><select name="webhosting" style="border: #000000 1px solid; font-family: Tahoma, Verdana; font-size: 10px; font-weight: normal; color: #000000";>
										<option value="<?php if (isset($_POST['webhosting'])) echo $_POST['webhosting']; ?>"><?php if (isset($_POST['webhosting'])) echo $_POST['webhosting']; ?></option>
										<option value="Yes">Yes</option>
										<option value="Now">No</option></select></td></tr>
<tr><td style="padding: 2px 0 0 0;">Budget:&nbsp;</td><td style="padding: 2px 0 0 0;"><select name="budget" style="border: #000000 1px solid; font-family: Tahoma, Verdana; font-size: 10px; font-weight: normal; color: #000000";>
										<option value="<?php if (isset($_POST['budget'])) echo $_POST['budget']; ?>"><?php if (isset($_POST['budget'])) echo $_POST['budget']; ?></option>
										<option value="$150.00 - $200.00">$150.00 - $200.00</option>
										<option value="$250.00 - $300.00">$250.00 - $300.00</option>
										<option value="$350.00 - $400.00">$350.00 - $400.00</option>
										<option value="$450.00 - $500.00">$450.00 - $500.00</option>
										<option value="$550.00 - $600.00">$550.00 - $600.00</option>
										<option value="$650.00 - $700.00">$650.00 - $700.00</option>
										<option value="$750.00 - $800.00">$750.00 - $800.00</option>
										<option value="$850.00 - $900.00">$850.00 - $900.00</option>
										<option value="$950.00 - $1000.00">$950.00 - $1000.00</option>
										<option value="$1000.00+">$1000.000+</option></td></tr>
<tr><td style="padding: 2px 0 0 0;">Phase:&nbsp;</td><td style="padding: 2px 0 0 0;"><select name="phase" style="border: #000000 1px solid; font-family: Tahoma, Verdana; font-size: 10px; font-weight: normal; color: #000000">
										<option value="<?php if (isset($_POST['phase'])) echo $_POST['phase']; ?>"><?php if (isset($_POST['phase'])) echo $_POST['phase']; ?></option>
										<option value="Concept Phase">Concept Phase</option>
										<option value="Blueprint Phase">Blueprint Phase</option>
										<option value="Development Phase">Development Phase</option>
										<option value="Utilization Phase">Utilization Phase</option></select></td></tr>
<tr><td colspan="2" style="text-align: right;">
	<input type="reset" value="Reset" style="margin: 10px 0 0 10px;" />
	<input type="submit" name="newproject" value="Start New Project" style="margin: 10px 0 0 0;" /></td></tr>
</form>
</table>

<?php
break;
}
?>		

Thanks ahead of time

#2 Guteman

Guteman
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts
  • LocationWisconsin

Posted 05 August 2006 - 08:04 PM

anyone please help?

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 05 August 2006 - 08:06 PM

what error do you get have you eho the query out try?
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 Guteman

Guteman
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts
  • LocationWisconsin

Posted 05 August 2006 - 08:30 PM

im not getting any errors. I have defined errors in my code, and they dont seem to work when I add in cases, but when I get rid of cases, it works fine. The rest of your sentence I cannot understand (typos)

#5 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 05 August 2006 - 10:37 PM

So, it doesn't echo any of the error messages but renders the rest of the html ok?
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users