Jump to content

Cases Issue


Guteman

Recommended Posts

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?

[code]
<?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;
}
?>
[/code]

Thanks ahead of time
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.