Jump to content

Drop Down Dysfunction


asianflayva

Recommended Posts

I need to add a drop down menu to my existing PHP. I'm new to this language and thought what I had written would work, but I keep getting an error with what I've got. Can anyone take a ganders at my code and let me know what I'm doing wrong? (It's the "opgroup" section.) Thanks.

<?
$form_block = "
<FORM METHOD=\"POST\" ACTION=\"$_SERVER[PHP_SELF]\">
<P><strong>Requester Name & Department:</strong><br><INPUT type=\"text\" NAME=\"reqname\" size=40></P>
<P><strong>Requester E-Mail:</strong><br><INPUT type=\"text\" NAME=\"reqemail\" size=40></P>
<P><strong>Requester Phone Number:</strong><br><INPUT type=\"text\" NAME=\"reqphone\" size=40></P>
<P><strong>Person Operator Code Requested For: (First, Middle & Last)</strong><br>
<INPUT type=\"text\" NAME=\"opcodereq\" size=40></P>
<P><strong>Requested Operator Code: (XXX)</strong><br><input type=\"text\" NAME=\"opcode\" size=20></P>
<P><SELECT NAME=\"opgroup\" size=1>
<OPTION value="">Please select an Operator Group</option>
<OPTION value=\"IT\">IT Staff</option>
<OPTION value=\"REG\">Registration</option>
<OPTION value=\"BLGD\">Registration/Billing-Dental/Eye Clerical Staff</option>
<OPTION value=\"BLG\">Registration/Billing/Prenatal/HSS</option>
<OPTION value=\"REC\">Reception/Medical Records/Social Workers</option>
<OPTION value=\"MGMT\">Management Staff</option>
<OPTION value=\"DATA\">Planning/Development/Fiscal</option>
<OPTION value=\"MED\">Providers/Nurses/Health Educators/Asst/Recepts</option>
<OPTION value=\"MIS\">MIS</option>
</SELECT></P>
<P><strong>Questions or Comments:</strong><br>
<TEXTAREA NAME=\"message\" rows=4 cols=40></textarea></P>
<INPUT type=\"hidden\" name=\"op\" value=\"ds\">
<P><INPUT type=\"submit\" NAME=\"submit\" VALUE=\"Send Request\"></P>
</FORM>";

if ($_POST[op] != "ds") {
// they need to see the form
echo "$form_block";
} else if ($_POST[op] == "ds") {
// check value of $_POST[reqname]
if ($_POST[reqname] == "") {
$reqname_err = "<font color=red><b>Please enter your Name and Department!</b></font><br>";
$send = "no";
}

// check value of $_POST[reqemail]
if ($_POST[reqemail] == "") {
$reqemail_err = "<font color=red><b>Please enter your Email Address!</b></font><br>";
$send = "no";
}

// check value of $_POST[reqphone]
if ($_POST[reqphone] == "") {
$reqphone_err = "<font color=red><b>Please enter your Phone Number!</b></font><br>";
$send = "no";
}

// check value of $_POST[opcodereq]
if ($_POST[opcodereq] == "") {
$opcodereq_err = "<font color=red><b>Please enter the name of the requested user! (First, Middle and Last.)</b></font><br>";
$send = "no";
}

// check value of $_POST[opcode]
if ($_POST[opcode] == "") {
$opcode_err = "<font color=red><b>Please enter a requested operator code! (XXX)</b></font><br>";
$send = "no";
}

// check value of $_POST[opgroup]
if ($_POST[opgroup] == "") {
$opgroup_err = "<font color=red><b>Please identify the operator group to which the employee needs access!</b></font><br>";
$send = "no";
}
if ($send != "no") {
// it's ok to send, so build the email
$msg = "E-MAIL SENT FROM LA MAQUINA\n";
$msg .= "Requester Name and Department: $_POST[reqname]\n";
$msg .= "Requester Email: $_POST[reqemail]\n";
$msg .= "Requester Phone: $_POST[reqphone]\n";
$msg .= "Requested User Name: $_POST[opcodereq]\n";
$msg .= "Requested Operator Code: $_POST[opcode]\n";
$msg .= "Operator Code Group: $_POST[opgroup]\n";
$msg .= "Message: $_POST[message]\n\n";

$to = "jdavenport@laclinica.org";
$subject = "Operator Code Request";
//send the mail
mail($to, $subject);
//display confirmation to user
echo "<P>Your request for an Operator Code has been sent!</P>";
} else if ($send == "no") {
//print error messages
echo "$reqname_err";
echo "$reqemail_err";
echo "$reqphone_err";
echo "$opcodereq_err";
echo "$opcode_err";
echo "$opgroup_err";
echo "$form_block";
}
}
?>
Link to comment
Share on other sites


[!--sizeo:5--][span style=\"font-size:18pt;line-height:100%\"][!--/sizeo--]echo ""[!--sizec--][/span][!--/sizec--] is the ansaw

All checked and working
[code]

<?
echo"<SELECT NAME=\'opgroup\' size=1>";
echo"<OPTION value=''>Please select an Operator Group</option>";
echo"<OPTION value=\'IT\'>IT Staff</option>";
echo"<OPTION value=\'REG\'>Registration</option>";
echo"<OPTION value=\'BLGD\'>Registration/Billing-Dental/Eye Clerical Staff</option> ";
echo"<OPTION value=\'BLG\'>Registration/Billing/Prenatal/HSS</option> ";
echo"<OPTION value=\'REC\'>Reception/Medical Records/Social Workers</option>";
echo"<OPTION value=\'MGMT\'>Management Staff</option> ";
echo"<OPTION value=\'DATA\'>Planning/Development/Fiscal</option> ";
echo"<OPTION value=\'MED\'>Providers/Nurses/Health Educators/Asst/Recepts</option>";
echo"<OPTION value=\'MIS\'>MIS</option> ";
echo"</SELECT></P> ";
echo"</form>";
?>
[/code]



Link to comment
Share on other sites

[b]redarrow[/b]: you don't need to escape the single quotes when enclosing the string in double quotes.
[code]<?php
echo"<form method='POST' action='quary.php'>";
echo"<SELECT NAME='opgroup' size=1>";
echo"<OPTION value=''>Please select an Operator Group</option>";
echo"<OPTION value='IT'>IT Staff</option>";
echo"<OPTION value='REG'>Registration</option>";
echo"<OPTION value='BLGD'>Registration/Billing-Dental/Eye Clerical Staff</option> ";
echo"<OPTION value='BLG'>Registration/Billing/Prenatal/HSS</option> ";
echo"<OPTION value='REC'>Reception/Medical Records/Social Workers</option>";
echo"<OPTION value='MGMT'>Management Staff</option> ";
echo"<OPTION value='DATA'>Planning/Development/Fiscal</option> ";
echo"<OPTION value='MED'>Providers/Nurses/Health Educators/Asst/Recepts</option>";
echo"<OPTION value='MIS'>MIS</option> ";
echo"</SELECT></P> ";
echo"</form>";?>[/code]

Also, this wouldn't work with the OP's code too well, since the OP is storing the whole form definition as a string.

Ken
Link to comment
Share on other sites

[!--quoteo(post=370983:date=May 3 2006, 01:10 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ May 3 2006, 01:10 PM) [snapback]370983[/snapback][/div][div class=\'quotemain\'][!--quotec--]
On this line:
[code]<OPTION value="">Please select an Operator Group</option>[/code]
you didn't escape the quotes:
[code]<OPTION value=\"\">Please select an Operator Group</option>[/code]

Ken
[/quote]

Ken,
I had one other issue besides the one I posted, but your response helped solved the specific error on the specific line problem that I was having.
Thanks mucho.
Jen
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.