| View previous topic :: View next topic |
| Author |
Message |
city New member

Joined: 14 Aug 2002 Posts: 7
|
Posted: Wed Sep 18, 2002 6:48 am Post subject: PHP script problem,, Phil does this help |
|
|
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 
Last edited by city on Mon Sep 23, 2002 1:59 am; edited 2 times in total |
|
| Back to top |
|
 |
phil karras Senior Member

Joined: 15 Jul 2002 Posts: 1776 Location: MD
|
Posted: Thu Sep 19, 2002 6:54 am Post subject: |
|
|
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 |
|
 |
city New member

Joined: 14 Aug 2002 Posts: 7
|
Posted: Fri Sep 20, 2002 10:30 am Post subject: will this help |
|
|
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 |
|
 |
|