Guteman Posted August 5, 2006 Share Posted August 5, 2006 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]<?phpswitch($_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: </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: </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: </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: </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: </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: </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: </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: </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? </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: </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: </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><?phpbreak;}?> [/code]Thanks ahead of time Link to comment https://forums.phpfreaks.com/topic/16659-cases-issue/ Share on other sites More sharing options...
Guteman Posted August 5, 2006 Author Share Posted August 5, 2006 anyone please help? Link to comment https://forums.phpfreaks.com/topic/16659-cases-issue/#findComment-69924 Share on other sites More sharing options...
redarrow Posted August 5, 2006 Share Posted August 5, 2006 what error do you get have you eho the query out try? Link to comment https://forums.phpfreaks.com/topic/16659-cases-issue/#findComment-69927 Share on other sites More sharing options...
Guteman Posted August 5, 2006 Author Share Posted August 5, 2006 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) Link to comment https://forums.phpfreaks.com/topic/16659-cases-issue/#findComment-69940 Share on other sites More sharing options...
king arthur Posted August 5, 2006 Share Posted August 5, 2006 So, it doesn't echo any of the error messages but renders the rest of the html ok? Link to comment https://forums.phpfreaks.com/topic/16659-cases-issue/#findComment-69971 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.