Advertisement

10.07.2008 at 10:50PM PDT, ID: 23796289
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.2

Option value and submit question

Asked by Simon336697 in PHP Scripting Language

Hi everyone.
Guys i have a php form where I need a little help.
I have a select box that gets its data from a mysql table.
When I select one of the options in the select box, then click on a submit button, I can retrieve that selected item, which I then remove that "record" from a mysql database.

The problem I have is this....

I want to add a "selected" option value to the select box, which is NOT pulled from a database, like the rest of the option values are.
I want this just to be seen on page load of the form, and just a simple message status saying the following:

<option value="default" selected="selected">--- Please Choose a Project ---</option>

I want this to be in this select box permanently, and for the form not to be allowed to be submitted if this has not been changed to a valid option value item from the select box (maybe a message saying..you need to select a valid option)

The problem is, is that when I click on submit, and if I have not chosen anything other than the top line, that is, if I chose:

<option value="default" selected="selected">--- Please Choose a Project ---</option>

then the select name is "SET", and upon post of this form, it goes to another page, which grabs this select name by the following..

if(!empty($_POST['projectidnumber'])) {
$project_to_delete=$_POST['projectidnumber'];

where 'projectidnumber' is the name of the select box.

So, what im asking is the following...

Is there any way to add a "message-type" status option value to a select box, which does NOT set the value of a select box element upon form submission, or another way around this?

Here is the complete select php code I have.

Any help greatly appreciated.

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
=========================================== delete_project.php
 
<div id="form_wrapper">
	<form name="form1" method="post" action="delete_project_ac.php">
		<table id="form1table">		
			<tr>
				<td class="nondescriptioncol1">Select a Project:</td>
				<td class="nondescriptioncol2">
					<select name="projectidnumber" id="projectidnumber">
						<option value="default" selected="selected">--- Please Choose a Project ---</option>
						<?php 
							while($row=mysql_fetch_array($result)) {
								echo "<option value=\"".$row['id_pro']."\">".$row['name_pro']."\n";	
							}
						?>
					</select>		
				</td>	
			</tr>
		</table>
		<center><input type="submit" name="Submit" value="Delete Project"></center>
	</form>
</div>	
 
================================================== delete_project_ac.php
if(!empty($_POST['projectidnumber'])) { 
		$project_to_delete=$_POST['projectidnumber'];
}
else {
 
blah blah
[+][-]10.07.2008 at 11:11PM PDT, ID: 22666512

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: PHP Scripting Language
Sign Up Now!
Solution Provided By: HiS_SlyneSS
Participating Experts: 1
Solution Grade: A
 
 
[+][-]10.07.2008 at 11:20PM PDT, ID: 22666544

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 - Hierarchy / EE_QW_2_20070628