Jump to content

Cant see my form


Cyberspace

Recommended Posts

I have included a form with my script by it doesnt display when i run the code:

 

<?php  
$WalkNo = $_GET['WalkNo'];

$WalkNo = mysql_real_escape_string($WalkNo);
$Venue = mysql_real_escape_string($Venue);
$WalkDate = mysql_real_escape_string($WalkDate);
$Leader = mysql_real_escape_string($Leader);

$account = mysql_fetch_array(mysql_query("SELECT * FROM walks WHERE WalkNo='$WalkNo'")); 


?> 
</table> 
<table class="join" cellspacing="0" width="861">
	<tr>
		<td class="Header">WalkNo</td>
		<td class="Body"><?php echo $account["WalkNo"]; ?></td>
	</tr>
	<tr>
		<td class="Header">Venue</td>
		<td class="Body"><?php echo $account["Venue"]; ?></td>  
	</tr>
	<tr>
		<td class="Header">WalkDate</td>
		<td class="Body"><?php echo $account["WalkDate"]; ?></td>
	</tr>
	<tr>
		<td class="Header">Leader</td>
		<td class="Body"><?php echo $account["Leader"]; ?></td>
	</tr>
</table>
<p> <hr class="hr_blue"/></p>

<font face="Arial" size="3"> Walk Participants</font>
<p></p>


<?php

$WalkNo = $_GET['WalkNo'];

$query = "SELECT w.WalkNo,
                 m.MemberRef,
                 m.Forename,
                 m.Surname,
                 w.DateJoined
          FROM members m,
               walker w
          WHERE w.MemberRef=m.MemberRef AND w.WalkNo='$WalkNo'";

$result = mysql_query($query) or die('Query error!<br />Error:' . mysql_error() . 'Query: <pre>' . $query . '</pre>');

if(mysql_num_rows($result) == 0)
{
     print "No Participants exist";
}
else
?>
<table class="join" cellspacing="0" width="861">
  <tr>
<td class="Header">WalkNo</td>
<td class="Header">Member Ref</td>
<td class="Header">Forename</td>
<td class="Header">Surname</td>
<td class="Header">DateJoined</td>
  </tr>
<?php
    while ($account = @mysql_fetch_assoc($result))
    {
?>
  <tr>
<td class="Body"><?php echo $account["WalkNo"]; ?></td>
<td class="Body"><?php echo $account["MemberRef"]; ?></td>
<td class="Body"><?php echo $account["Forename"]; ?></td>
<td class="Body"><?php echo $account["Surname"]; ?></td>
<td class="Body"><?php echo $account["DateJoined"]; ?></td>
  </tr>
<?php
    }
?>
</table>

<?php 


if (isset($_POST['submit'])) {   

    $error_stat = 0;   
    $MemberRef_message = '';  
    $Password_message = ''; 
    $Password2_message = ''; 
    $User_message = ''; 
    $Walk_message = ''; 

    $MemberRef = mysql_real_escape_string(stripslashes($_POST['MemberRef'])); 
    $Password = mysql_real_escape_string(stripslashes($_POST['Password'])); 
     
//Error checking   

// MemberRef Check)   
if (!$MemberRef) {  
//Set the error_stat to 1, which means that an error has occurred  
    $error_stat = 1;  

//Set the message to tell the user to enter a username  
    $MemberRef_message = '*Please enter MemberRef*';  
}  

else if (!ctype_digit($MemberRef)) {   
   $error_stat = 1;   
   $MemberRef_message .= '*MemberRef must be a number*';   
}  

if (!$Password) {  
//Set the error_stat to 1, which means that an error has occurred  
    $error_stat = 1;  

//Set the message to tell the user to enter a password  
    $Password_message = '*Please enter a Password*';  

} 


// MemberRef and Password Check

if (isset($_POST['submit']) && $error_stat == 0) {  

$account = mysql_query("SELECT * FROM members WHERE MemberRef='$MemberRef' AND  Password='$Password'"); 
$numrows = mysql_num_rows($account); //get rows returned 

if($numrows == 0) 
{  
    $error_stat = 1;  
    $User_message = 'Username and/or Password are invalid';  
} 



// Walker Check

if (isset($_POST['submit']) && $error_stat == 0) {  

$account = mysql_query("SELECT * FROM walker WHERE MemberRef='$MemberRef' AND  WalkNo='$WalkNo'"); 
$numrows = mysql_num_rows($account); //get rows returned 

if($numrows == 1) 
{  
    $error_stat = 1;  
    $Walk_message = 'User is already on walk';  
}   

}
}
?>


<hr class="hr_blue"/></p><font face="Arial" size="3">Join Walk</font><form method="post" class="addwalkerform" action="">    
</font> 
<fieldset> 
<label for="MemberRef">MemberRef:</label>   
<input name="MemberRef" type="text" id="MemberRef" value="<?php echo $_POST['MemberRef']; ?>"/>  
<span class="redboldtxt"><?php echo "$MemberRef_message";?></fieldset></span>   
</fieldset> 

<fieldset> 
<label for="Password">Password:</label>   
<input name="Password" type="text" id="Password" value="<?php echo $_POST['Password']; ?>"/>  
<span class="redboldtxt"><?php echo "$Password_message";?></fieldset></span> 
<span class="redboldtxt"><?php echo "$Password2_message";?></fieldset></span> 

<fieldset>  
<p class="submit"><input type="submit" name="submit" value="Join Walk" /> 

<span class="redboldtxt"><?php echo "$User_message";?></fieldset></span> 

<span class="redboldtxt"><?php echo "$Walk_message";?></fieldset></span> 


</fieldset> 


</fieldset> 
</form> 

<?php 
}

?> 

Link to comment
https://forums.phpfreaks.com/topic/100561-cant-see-my-form/
Share on other sites

Just to be sure it's actually including/finding THIS file, put something at the top of the file--doesn't even need to be PHP code if you put it before the "<?PHP" tag.

 

Something as simple and obvious as your name.  If you don't see that, then assume there's an issue with finding the right file.

 

A problem with brackets should be throwing errors unless you've gor error reporting turned off--if it's off, turn it back on.

Link to comment
https://forums.phpfreaks.com/topic/100561-cant-see-my-form/#findComment-514358
Share on other sites

Just to be sure it's actually including/finding THIS file, put something at the top of the file--doesn't even need to be PHP code if you put it before the "<?PHP" tag.

 

Something as simple and obvious as your name.  If you don't see that, then assume there's an issue with finding the right file.

 

A problem with brackets should be throwing errors unless you've gor error reporting turned off--if it's off, turn it back on.

 

Hey i got this sorted, thanks for the help  :)

Link to comment
https://forums.phpfreaks.com/topic/100561-cant-see-my-form/#findComment-514383
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.