Jump to content


Photo

Drop Down Dysfunction


  • Please log in to reply
5 replies to this topic

#1 asianflayva

asianflayva
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 03 May 2006 - 05:59 PM

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";
}
}
?>

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 03 May 2006 - 06:10 PM

On this line:
<OPTION value="">Please select an Operator Group</option>
you didn't escape the quotes:
<OPTION value=\"\">Please select an Operator Group</option>

Ken

#3 redarrow

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

Posted 03 May 2006 - 06:14 PM


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

All checked and working

<?
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>";
?>




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 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 03 May 2006 - 06:20 PM

redarrow: you don't need to escape the single quotes when enclosing the string in double quotes.
<?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>";?>

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

#5 redarrow

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

Posted 03 May 2006 - 06:24 PM

sorry so what does he do lol

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

#6 asianflayva

asianflayva
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 03 May 2006 - 08:29 PM

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

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users