Solved

posting variable into function doesnt work

Posted on 2009-03-31
2
185 Views
Last Modified: 2012-05-06
hi all posting my variable $error into the showform function doesnt seem to work, can anyone tell me why?

thanks
<?php 

function ShowForm($error) {

?>

<div class="text">

<h2>Staff Log In </h2>

<form id="form" method="post" action="/includes/login.php" class="menu">

  <table width="544">

     <tr>

       <td>Username:</td>

      <td><input name="txtUserName" type="text" size="20"  /></td>

      <td rowspan="5">&nbsp;</td>

     </tr>

     <tr>

      <td>Password:</td><td><input name="txtPassword" type="password" size="20" /></td>

     </tr>

     <tr>

       <td>&nbsp;</td>

       <td><input name="submit" type="submit" value="Login" /></td>

     </tr>

      <tr>

        <td colspan="2"><?php echo $error; ?></td>

      </tr>

      <tr>

      <td colspan="2">Lost your password? <a href="/admin/lostpass.php">Click Here</a></td>

      </tr>

    </table>

</form>

</div>

<?php

}
 

switch(@$_GET["action"]) {

Case "adminonly":

include($_SERVER['DOCUMENT_ROOT'] . '/includes/connection.php');

include($_SERVER['DOCUMENT_ROOT'] . '/includes/header.php');

$error = '<span style="padding-top:30px; color:#FF0000; ">';

$error .= '<strong>Error:</strong><br /> You need to be a member of staff to access these pages.';

$error .= '</span>';

ShowForm();

Open in new window

0
Comment
Question by:awilderbeast
2 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
Comment Utility
change:
ShowForm();

into:
ShowForm($error);
0
 
LVL 1

Author Closing Comment

by:awilderbeast
Comment Utility
ahhh yes how silly of me :)

thankyou :)
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now