Book Section
-----
TY JavaScript 3rd Ed.
Teach Yourself JS 1.5
Teach Yourself DHTML
Teach Yourself JS 1.3
LLWW: JavaScript

General Section
-----
Discussion Forum
Articles / Tips
JavaScript Links
About the Author
Privacy Policy
Contact Me



Other Sites
-----
Website Workshop
JavaScript Weblog

JavaScript Workshop Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
PHP script problem,, Phil does this help

 
Post new topic   Reply to topic    JSWorkshop Forum Index -> Server-Side Languages
View previous topic :: View next topic  
Author Message
city
New member
New member


Joined: 14 Aug 2002
Posts: 7

PostPosted: Wed Sep 18, 2002 6:48 am    Post subject: PHP script problem,, Phil does this help Reply with quote

if ($action=="add_two") {
if ($name=="" or $email=="" or $password=="" or $post=="") {
showheader("All the Fields Have Not Been Filled in");
echo "You Must Fill in all fields before proceeding";
showfooter();
exit;
}


<FORM METHOD=POST ACTION="<?php echo $PHP_SELF ?>">
<INPUT TYPE="hidden" name="action" value="add_two">


This is part of a script to provide a discussion forum.And some the related HTML. Whats bugging me is what exactlly does the if statement at the top do. if ($action=="add_two") i know it has something to with the form HTML thats why included but i have no idea on its functionality.

help

thanks Very Happy


Last edited by city on Mon Sep 23, 2002 1:59 am; edited 2 times in total
Back to top
View user's profile Send private message
phil karras
Senior Member
Senior Member


Joined: 15 Jul 2002
Posts: 1776
Location: MD

PostPosted: Thu Sep 19, 2002 6:54 am    Post subject: Reply with quote

How are we supposed to know without the code it refers to?

I can only tell you that if the $action var contains the word "add_two" then it does what's inside but only IF all the other input fields have something in them, the second if statement.
_________________
Phil K
Circle Software Consulting
Test website: http://cs.yrex.com/
Guidelines for Posting: http://www.jsworkshop.com/posting.html
IHBAAA = It Has Been Asked And Answered
KISS: http://www.jsworkshop.com/bb/viewtopic.php?t=508
Back to top
View user's profile Send private message Visit poster's website
city
New member
New member


Joined: 14 Aug 2002
Posts: 7

PostPosted: Fri Sep 20, 2002 10:30 am    Post subject: will this help Reply with quote

Phil here some more of te code,

<?php

require( './functions.php3');

if ($action=="add_two") {
if ($name=="" or $email=="" or $password=="" or $post=="") {
showheader("All the Fields Have Not Been Filled in");
echo "You Must Fill in all fields before proceeding";
showfooter();
exit;
}
addpost();
showheader("Your Post has successfully been added");
echo "Your post was added, and your post password is $password.<P>You may go back now and view it";
showfooter();
}
else {
$topic_query = mysql_query("SELECT TopicName FROM topics WHERE (ID=$topicID)");
$topic = mysql_fetch_array($topic_query);
?>




<FORM METHOD=POST ACTION="<?php echo $PHP_SELF ?>">
<INPUT TYPE="hidden" name="action" value="add_two">
<INPUT TYPE="hidden" name="topicID" value="<?php echo $topicID ?>">
<INPUT TYPE="hidden" name="TopicName" value="<?php echo $topic['TopicName'] ?>">


i hope that can help phil in what the code is referring too same qusetion as before whatis the action varaible doing.

thanks city.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    JSWorkshop Forum Index -> Server-Side Languages All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
(c) 1997-2002 Starling Technologies and Michael Moncur. Portions (c) Sams Publishing.