PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old September 30th, 2004, 10:43 AM
caskav caskav is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Oregon, USA
Posts: 2 caskav User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Elseif statement being ignored - ?

I am new to php and trying a simple load script. I have scaled it down to try to find the problem. When it gets to the elseif statement, it just displays the form. I know that the op and the names are set (I can echo them back just prior to the elseif). If I skip the elseif, the data loads just fine. Any help on the basic, yet frustrating issue would be greatly appreciated.

================================================== ===============
<?php
if ($POST[op] != "add") {
$display_block = "<form method=\"post\" action=\"$_SERVER[PHP_SELF]\">

<p>Primary Parent bringing child(ren) to park: <br>
First name: <input type=\"text\" name=\"mem_first\" size=25><br>
Last name: <input type=\"text\" name=\"mem_last\" size=25><br></p>

<input type=\"hidden\" name=\"op\" value=\"add\">

<p><input type=\"submit\" name=\"submit\" value=\"Add Entry\"></p>
</form>";


//These lines echo back the op and names with no problem, just above the form re-display, so I know they are there
echo "$_POST[op];
echo "$_POST[mem_first]";
echo "$_POST[mem_last]";

} elseif ($_POST[op] == "add") {
//time to add to tables, so check for required fields
if (($_POST[mem_first] == "") || ($_POST[mem_last] == "")) {
header("Location: addtest.php");
exit;
}

// I never get this far, unless I take out the elseif.
echo "made it past the else statement";

$conn = mysql_connect("localhost", "root") or die(mysql_error());
mysql_select_db('cip',$conn) or die(mysql_error());


$add_member="insert into member values ('','$_POST[mem_first]', '$_POST[mem_last]', 'new', 'circle',
#'$_POST[status]', '$_POST[park]',
'$_POST[spouse_first]', '$_POST[spouse_last]', 'n',
#'$_POST[daycare_provider]',
now(), now())";
mysql_query($add_member) or die(mysql_error());
.
.
.
.
================================================== ==========

Reply With Quote
  #2  
Old September 30th, 2004, 12:10 PM
caskav caskav is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Oregon, USA
Posts: 2 caskav User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Problem solved - I'm pretty embarrassed - total newbie mistake. Forgot underscore in second line. I looked at it all night last night - guess I needed some sleep.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Elseif statement being ignored - ?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway