Solved

posting variable into function doesnt work

Posted on 2009-03-31
2
190 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Accepted Solution

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

into:
ShowForm($error);
0
 
LVL 1

Author Closing Comment

by:awilderbeast
ID: 31564746
ahhh yes how silly of me :)

thankyou :)
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Add a date range function to PDF Generation 9 42
PHP processing webform 25 45
How can I use javascript variable in mysql query 21 46
Prestashop modules custimzation 2 29
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

752 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