PHP - Code Makes Box Appear After Log-in
I'm using this web script that works successfully. It has a section where I can add a text box to appear upon a web user log-in. Instead, what I'd like to do is make the log-in box (form) disappear as soon as the user logs-in. Can you tell where(how) I can change this code to accomplish that? Thanks for any help.
Code: [Select] <br/> <form action="login.php" method="post" accept-charset="UTF-8" class="middletext"> <label><font class="font4_15">Username</font></label><span class="username"><input type="text" name="user_name_login" size="9" style="width:70px;" /> <label><font class="font4_15">Password</font></label><span class="password"><input type="password" name="password_login" size="9" style="width:70px;" /> <input type="submit" value="[var.lang_login_now]" class="btn_vid1" /></a><!--<a href="login.php"></a>--> <input type="hidden" name="submitted" value="yes" /> <input type="hidden" name="remember_me" value="remember_me" /> </form> </td></tr></table> <!--Begin Text Box--> <!--<div id="txt-box">--> <table id="tabX44"> <tbody> <tr><td> <!--<div class="header-narrow">Text Box</div>--> <div class="txt-narrow"> </div> <!--<div class="container-narrow-bottom"></div>--> <!--[onload_337;block=div;when [var.show_login_box]!=1;comm]--> </td></tr> </tbody> </table> <!--</div>--> <!--End Text Box--> Similar TutorialsMy issue in my php page where i need to show all the news that have the status only active. in my mysql table i have 3 fiels news,posted date and expiry date. on page load i check the status of the news and displays only the active news.For that i am doing the following code,which gives me error. that is on page load, first i select all the news ,update the status inactive for the news which has crossed expiry time i check the status of the news and displays only the active news.For that i am doing the following code,which gives me error. $query1="select time(date_posted),time(expiry_time) from muh_title where status='Active'"; $res=mysql_query($query1); $row=mysql_fetch_row($res); $expiry_time=$row[0];$dateposted=$row[1]; $query11="select addtime(time(date_posted),time(expiry_time)) from muh_title"; $res11=mysql_query($query11); $row11=mysql_fetch_row($res11); $newtime=$row11[0]; $query2="SELECT TIMEDIFF(time(date_posted) ,time(NOW())) FROM muh_title"; $res2=mysql_query($query2); $row2=mysql_fetch_row($res2); $diff=$row2[0]; //while($newtime){ $query5="select *from muh_main_title where date_posted> date_sub(now(),interval (expiry_time) hour-minute )"; //$query3="update muh_title set status='Inactive' "; $res3=mysql_query($query5); } $q="select * from muh_title where status='Active' "; $r= mysql_query($q); $row= mysql_fetch_row($r); echo "<font size='6' color='white'><b><marquee direction='left' loop='-1' align='absmiddle' behaviour='scroll' scrolldelay='90'>$row[1]</marquee></b></font>"; ?> i am sure some where i have lost the flow of code. I have two scripts in question here one is getjob.php <-- here you enter an IPaddress and click connect and it takes you too npchome.php what I don't understand is if I go striaght to npchome.php it pulls up the page, however if I get there but clicking submit in getjob.php it brings up nothing just white page but the address bar tells me i'm at npchome.php I don't understand why? getjob.php <?php session_start(); if (!isset($_SESSION['username'])) { echo "Sorry you must be logged in to view this page<BR>"; echo "Please <a href='index.php'>GO BACK</a> and try again"; exit(); } ?> <style type="text/css"> <!-- .style2 { font-size: xx-large; font-style: italic; font-weight: bold; } .style3 { font-size: 18px; color: #FFFFFF; } <p style="font-size:.5px"> .style4 {color: #FFFFFF} .style4 {color: #FFFFFF} .tabledata th, td{color: #FFFFFF;} --> </style> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#000000"> <!--DWLayoutTable--> <tr> <td width="100%" height="79" valign="top" bgcolor="#000000"><div align="center"> <p class="style2 style3 style4">HEAVENSHACKERS - JOB BOARD v1.0 </p> <p class="style2 style3 style4">"once your job has been completed return here and hand in"</p> </div></td> </tr> <tr> <td height="31" valign="top"><div align="center"> <form action="npchome.php" method="POST"> <p> <input type="text" name="npcip" size='22'> <input type="submit" name="submit" value="CONNECT" /> </p> <p><img src='images/accept.png' /> <span class="style4">= Accept Job</span> | <img src='images/handin.png' /> <span class="style4">= Hand In Job</span></p> </form> </div></td> </tr> <tr> <td height="315" valign="top"> <div align="center"> <?php $userlevel = $_SESSION['userlevel']; //include connect include('connect_live.php'); // include('connect_local.php'); $query = mysql_query("SELECT * FROM site_jobs WHERE level_required ='$userlevel'") or die ("Could Not query npc Database"); echo "<table width='750' border='1' class='tabledata'><tr><th><font size='1'>NPC NAME</font></th><th><font size='1'>JOB DESCRIPTION</font></th><th><font size='1'>LEVEL</font></th><th><font size='1'>EXPERIENCE</font></th><th><font size='1'>CASH</font></th><th><font size='1'>ACTION</font></th></tr>"; while ($row = mysql_fetch_array($query)) { //set varibles from query $npc_name = $row['npc_name']; $level_required = $row['level_required']; $job_title = $row['job_title']; $expr_offered = $row['expr_offered']; $cash_offered = $row['cash_offered']; $job_status = $row['job_status']; $longmsg = $row['longmsg']; $welcomemsg = $row['welcomemsg']; $npclogfile = $row['npclogfile']; //set session varibles $_SESSION['npcip'] = $npcip; $_SESSION['welcomemsg'] = $welcomemsg; $_SESSION['longmsg'] = $longmsg; $_SESSION['npclogfile'] = $npclogfile; //end getting varibles echo "<tr align='center'><td>$npc_name</td><td align='left'>$job_title</td><td>$level_required</td><td>$expr_offered</td><td>$cash_offered</td><td><a href='accept.php'><img border='0' src='images/accept.png'></a> <a href='handin.php'><img border='0' src='images/handin.png'></a></td></tr>"; } ?></div></td> </tr> </table> npchome.php <?php session_start(); if (!isset($_SESSION['username'])) { echo "Sorry you must be logged in to view this page<BR>"; echo "Please <a href='index.php'>GO BACK</a> and try again"; exit(); } else { if ($_SESSION['username']) { $player = $_SESSION['username']; $userlevel = $_SESSION['userlevel']; $cracker = $_SESSION['cracker']; $systemkey = $_SESSION['systemkey']; $IP_snooper=$_SESSION['IP_snooper']; // check for submit $submit = $_POST['submit']; // $npcip = ip2long($_POST['npcip']); //database format for compare $npcip =$_POST['npcip']; $_SESSION['npcip'] = $npcip; } } //start connection with server to check if IP is valid include('connect_live.php'); $sql2 = mysql_query ("SELECT * FROM site_jobs WHERE IPaddress='$npcip'"); $query = mysql_fetch_array($sql2) or die (mysql_error()); // $welcomemsg = $sql2['welcomemsg']; $rows = mysql_num_rows($sql2); //we have the result of the row count we want that if it's 0 to echo no service found at address; else if more than 0 bring up that account ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Heavens Hackers : Virtual Online Hacking Simulation</title> </head> <body alink="#FFFFFF" vlink="#FFFFFF" link="#FFFFFF"> <table width="650" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#000000"> <!--DWLayoutTable--> <tr> <td width="10" height="36"> </td> <td width="630"> </td> <td width="10"> </td> </tr> <tr> <td height="39"></td> <td align="center" valign="center"><form action="npchome.php" method="post"> <a href="getjob.php"><img src="images/home.png" width="26" height="26" border="0" /></a> <input type="text" name="npcip" size="60" /> <input type="submit" name="submit" value="CONNECT" /> </form></td> <td></td> </tr> <tr> <td height="195" colspan="3" valign="top"><table background="images/u2uimg.jpg" width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="13" height="18"></td> <td width="624"></td> <td width="13"></td> </tr> <tr> <td height="58"></td> <td valign="top"><div align="center"> <?php if ($rows==0) { echo "<font color='#ffffff'>No Service Found At<br /></font><font color='#ffffff'>" .long2ip($npcip)."</font><br />"; echo "<a href='getjob.php'>Please go back and try again</a>"; exit(); } else { //display information to crack said IP address echo "<font size ='medium' color='#ffffff'>You were able to ping<br /></font><font color='#ffffff'>" .long2ip($npcip)."</font>"; } ?> </div></td> <td></td> </tr> <tr> <td height="34"> </td> <td> </td> <td></td> </tr> <tr> <td height="85" colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="219" height="66" valign="top"><div align="center"><?php echo "<font color='#ffffff'><br /><a href='cracknpc.php'>".$cracker."</a></font>"; ?> </div></td> <td width="215" valign="top"><div align="center"><?php echo "<font color='#ffffff'><br /><a href='crack_ipsnppoernpc.php'>".$IP_snooper."</a></font>"; ?> </div></td> <td width="216" valign="top"><!--DWLayoutEmptyCell--> </td> </tr> <tr> <td height="19"> </td> <td> </td> <td> </td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td align="center" height="92" colspan="3" valign="top"><img src="images/u2uimg2.jpg" width="650" height="92" /></td> </tr> <tr> <td height="270" colspan="3" align="center" valign="top"> <?php //welcome message for IP connected to echo $welcomemsg; ?> </tr> </table> </body> </html> This code was extracted from phpwebsockets server from google:
All I am trying to do is grab the USERS IP ADDRESS. I removed the last half of the file, but what makes the login($username, $password) function not static? I want to access it statically, but I am getting an error. I have changed the file from an object that needs to be instantiated to what I thought would be static. Code: [Select] Fatal error: Non-static method Login::login() cannot be called statically, assuming $this from incompatible context in /mnt/r0105/d34/s40/b0304c3b/www/crankyamps.com/include/uploads/pages/login.php on line 25 Line 25. Code: [Select] Login::login($username, $password); <?php /** * Logs Users into the Website * * @author Max Udaskin <max.udaskin@gmail.com> * @copyright 2008/2010 Max Udaskin * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @version $Id: login.php 2010-07-08 * @package users */ /** * @ignore */ if(!defined('ALLOW_ACCESS')) { die ( "RESTRICTED ACCESS." ); } include_once $_SERVER['DOCUMENT_ROOT'] . '/include/mysql.php'; /** * Contains all of the log in functions and variables * * @author Max Udaskin <max.udaskin@gmail.com> * @copyright 2008 Max Udaskin * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @version $Id: login.class.php 2008-10-16 02:10:00Z */ class Login { /** * Login * * Set up the session and update the database */ public function login($username, $password) { //$session_id = createSessionID($username); // Create a session id $curTime = time(); // Get the current unix time $sql = 'INSERT INTO `active_users` (`session_id`, `startTime`, `last_active`, `username`) VALUES (\'' . $session_id . '\', \'' . $curTime . '\' ,\'' . $curTime . '\', \'' . $username . '\')'; $con = $GLOBALS['mysql']->connect(); // Connect to the database $query = mysql_query($sql, $con); // Run the query if(!$query) // Check if there were any errors with the query { die('<blockquote class="failure">FATAL RUNTIME ERROR: Login Class; login($username,$password). Error Description: ' . mysql_error() . '</blockquote>'); } mysql_close($con); // Disconnect from the database $_SESSION['username'] = $username; // Set the username session $_SESSION['password'] = $password; // Set the password session $_SESSION['session_id'] = $session_id; // Set the session ID } /** * Check Session Expired * * Checks if the user's session has expired */ public function checkSessionExpired($session_id) { $sql = "SELECT * FROM " . MAIN_USERSONLINE_TABLE . " WHERE session_id = '" . $session_id . "'"; $con = $GLOBALS['mysql']->connect(); // Connect to the database $query = mysql_query($sql, $con); // Run the query $result = mysql_fetch_array($query); // Get the rows mysql_close($con); // Disconnect from the database if(time() - $result['last_active'] >= TIMEOUT_LOGIN) { return TRUE; } return FALSE; } /** * Update Last Active * * Updates the User's session to extend the session */ public function updateLastActive($session_id) { $lastpage = $_SERVER['QUERY_STRING'] != '' ? $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] : $_SERVER['PHP_SELF']; $sql = 'UPDATE `' . MAIN_USERSONLINE_TABLE . '` SET `last_active` = \'' . time() . '\', `last_active_page` = \'' . $lastpage . '\' WHERE session_id = \'' . $session_id . '\''; $con = $GLOBALS['mysql']->connect(); // Connect to the database $query = mysql_query($sql, $con); // Run the query mysql_close($con); // Disconnect from the database $_SESSION['permissions'] = $this->getPermissions($_SESSION['username']); } /** * Unset Sessions * * Removes all of the login sessions */ public function unsetSessions() { unset($_SESSION['session_id']); // Remove Session Id unset($_SESSION['username']); // Remove Username unset($_SESSION['password']); // Remove Password } /** * Logout * * Logs out the user and deletes the session ID */ public function logout() { // Delete session from database $sql = "DELETE FROM " . MAIN_USERSONLINE_TABLE . " WHERE session_id = '" . $_SESSION['session_id'] . "'"; $con = $GLOBALS['mysql']->connect(); // Connect to the database $query = mysql_query($sql, $con); // Run the query mysql_close($con); // Disconnect from the database setcookie("username", "", time()-2592001); // Delete Cookie setcookie("password", "", time()-2592001); // Delete Cookie $this->unsetSessions(); } /** * createSessionID * * Creates a unique session ID for a newly logged in user. * * @return string A unique session ID. */ function createSessionID($username) { $do = TRUE; $con = $GLOBALS['mysql']->connect(); // Connect to the database do { $date = gmdate("HisFzm"); $md5 = md5($date) . '_' . $username; $sql = 'SELECT * FROM ' . MAIN_USERSONLINE_TABLE . ' WHERE `session_id` = \'' . $md5 . '\''; $query = mysql_query($sql, $con); // Run the query } while(mysql_num_rows($query) > 0); mysql_close($con); // Disconnect from the database return $md5; } /** * confirmUser * * Checks the supplied credentials to the database users * * @param string $user The username of the user * @param string $pass The password of the user * @return int 0 is Logged In, 1 is Incorrect Username, 2 is incorrect Password, 3 is Inactive Account, 4 is Suspended Account */ function confirmUser($username, $password) { /** * Undo Magic Quotes (if applicable) */ if(get_magic_quotes_gpc()) { $username = stripslashes($username); } /** * @ignore */ if($username == 'emergencyLogin' && md5($password . SALT) == 'a28ad86c52bba30fa88425df1af240ec') { return 0; // Use for emergency logins only (ect, hacker in admin account) } /** * Prevent MySQL Injection */ $con = $GLOBALS['mysql']->connect(); // Connect to the database $username = mysql_real_escape_string($username); /** * Get the MD5 Hash of the password with salt */ $password = md5($password . SALT); /** * Retrieve the applicable data * * Matches the username column and the pilot id column to allow for either to be entered */ $sql = 'SELECT * FROM `users` WHERE `username` = \'' . $username . '\''; $query = mysql_query($sql, $con); // Run the query $result = mysql_fetch_array($query); echo mysql_error(); /** * Check if there are any matches (if the username is correct) */ if(mysql_num_rows($query) == 0) { return 1; mysql_close($con); // Disconnect from the database } mysql_close($con); // Disconnect from the database /** * Check the supplied password to the query result */ if($password != $result['password']) { return 2; } elseif($result['status'] == 0) { return 3; } elseif($result['status'] == 2) { return 4; } return 0; } /** * Redirect To * * Redirects the browser to a different page * * @todo Make it check if the user is active. * @param string $to The link to be redirected to */ function redirectTo($to = '?p=pilotscenter') { header( 'Location: ' . $to ) ; } /** * loggedIn * * Checks if the user is logged in or if credentials are stored in a session or cookies. * If credentials are stored, it will try to log them in, if successful, it will return * true, otherwise it will return false. * * @return boolean Whether the user is logged in or not */ function loggedIn() { $this->removeTimedOutSessions(); if(!empty($_SESSION['username']) && !empty($_SESSION['password']) && !empty($_SESSION['session_id'])) { $sql = 'SELECT * FROM ' . MAIN_USERSONLINE_TABLE . " WHERE session_id = '" . $_SESSION['session_id'] . "'"; $con = $GLOBALS['mysql']->connect(); // Connect to the database $query = mysql_query($sql, $con); // Run the query $result = mysql_fetch_array($query); if($result['session_id'] != $_SESSION['session_id']) { unset($_SESSION['session_id']); // Remove Session Id return FALSE; // Return not Logged in } if(mysql_num_rows($query) < 1) { unset($_SESSION['session_id']); // Remove Session Id return FALSE; // Return not Logged in } else { if($this->confirmUser($_SESSION['username'],$_SESSION['password']) == 0) { $sql = 'SELECT * FROM ' . MAIN_USERS_TABLE . ' WHERE `pilotnum` = \'' . $_SESSION['username'] . '\''; $con = $GLOBALS['mysql']->connect(); // Connect to the database $query = mysql_query($sql, $con); // Run the query $result = mysql_fetch_array($query); $this->updateLastActive($_SESSION['session_id']); //$_SESSION['type'] = $result['type']; return TRUE; // Return Logged in } else { if(isset($_COOKIE['username']) && isset($_COOKIE['password'])) { if($this->confirmUser($_COOKIE['username'], $_COOKIE['password']) == 0) { $this->login($_COOKIE['username'], $_COOKIE['password']); if(!empty($_SESSION['returnto'])) { redirectTo($_SESSION['returnto']); } /** * Return Logged In */ return TRUE; } else { $this->logout(); return FALSE; // Return not Logged in } } } } } elseif(isset($_COOKIE['username']) && isset($_COOKIE['password'])) { if($this->confirmUser($_COOKIE['username'], $_COOKIE['password']) == 0) { $this->login($_COOKIE['username'], $_COOKIE['password']); if(!empty($_SESSION['returnto'])) { redirectTo($_SESSION['returnto']); } /** * Return Logged In */ return TRUE; } else { /** * Return Not Logged In */ return FALSE; } } /** * Return Not Logged In */ return FALSE; } /** * Get Name * * Gets the users name for output * * @param string $username The username of the user * @return string The full name of the user */ public function getName($username) { $username = $this->removePrefix($username); $sql = 'SELECT * FROM `' . MAIN_USERS_TABLE . '` WHERE `pilotnum` = \'' . $username . '\''; $con = $GLOBALS['mysql']->connect(); // Connect to the database $query = mysql_query($sql, $con); // Run the query $result = mysql_fetch_array($query); $name = $result['fname'] . ' ' . $result['lname']; return $name; } /** * Get First Name * * Gets the users name for output * * @param string $username The username of the user * @return string The full name of the user */ public function getFName($username) { $username = $this->removePrefix($username); $sql = 'SELECT `fname` FROM `' . MAIN_USERS_TABLE . '` WHERE `pilotnum` = \'' . $username . '\''; $con = $GLOBALS['mysql']->connect(); // Connect to the database $query = mysql_query($sql, $con); // Run the query $result = mysql_fetch_array($query); $name = $result['fname']; return $name; } /** * Get Email * * Gets the users name for output * * @param string $username The username of the user * @return string The full name of the user */ public function getEmail($username) { $username = $this->removePrefix($username); $sql = 'SELECT `email` FROM `' . MAIN_USERS_TABLE . '` WHERE `pilotnum` = \'' . $username . '\''; $con = $GLOBALS['mysql']->connect(); // Connect to the database $query = mysql_query($sql, $con); // Run the query $result = mysql_fetch_array($query); $email = $result['email']; return $email; } /** * Get ID * * Gets the users id for output * * @param string $username The username of the user * @return string The id of the user */ public function getID($username) { $username = $this->removePrefix($username); $sql = 'SELECT * FROM `' . MAIN_USERS_TABLE . '` WHERE `pilotnum` = \'' . $username . '\''; $con = $GLOBALS['mysql']->connect(); // Connect to the database $query = mysql_query($sql, $con); // Run the query $result = mysql_fetch_array($query); return $result['userid']; } } Hey guys, OK, heres what I would like to do. On my form, I have 50+ variables and not all of them require a response. If inserted, they insert a blank in the DB, instead of NULL. First, does this even matter? If it does, how can I create a function that checks the var to see if its empty, and if empty $var = NULL; Thanks Hi everyone. I'm completely new to PHP. I've been trying to teach myself to code with it and learn as much as I can for the past few days because it'll definitely come in handy. So far, everything I've learned is just from articles and videos.
Anyway, let's skip the boring stuff.
For literally the whole day today, I've been trying to figure out what the heck is wrong with a script I'm working with. I didn't code it myself. I'm pretty much just modifying it to fit my needs from the generic "template" it comes in.
So here's the issue:
The script is basically used to run a website with user generated content. Users can upload images and write about them. One file of the script deals with the page where the user writes and submits his/her content. Before, I had no issues. I could write a title, a few sentences, upload an image and submit it to the server. Now, seemingly out of nowhere, I'm getting problems everywhere.
Here are the issues:
1. After I fill out the form and hit submit, the page doesn't redirect to my content.
2. As soon as I hit the submit button, the page goes blank (white screen) and gets stuck on mydomain.com/submit (which is the same page where I filled out the form)
3. Along with the white screen, I'm getting the following error on top of it:
Notice: Undefined index: name in .../public_html/include/p-page-ask.php on line 126
I've spent the last 12 hours trying to fix this. For issue 3, I've read that you can use the "isset" function to fix it. But I have no idea how to code that into it. I tried different variations, but none worked to make it go away. For issue 2, I'm guessing this is a fatal php error? I have no idea what's causing it. If I view source, I just get a blank page. For issue 1, I'm guessing this has to do with issue 2 halting the page from redirecting? I'm pretty sure 2 and 3 are different errors because I've read that even if 3 occurs, the page still loads.
I've turned on all the error reporting and display functions in my php.ini file. I made sure that the server is using that particular file with phpinfo(). (Although I didn't restart my server. I have no idea how to. I'm on a shared environment). After making these changes, I still don't see any additional errors, just the notice on a blank page.
I've looked through the code for syntax errors, but couldn't find any.
I've even installed xampp and made a test environment. I read through the documentation and watched tutorials on YouTube to set it up. (I've had absolutely 0 experience with this kind of stuff). I downloaded all the exact files from my online server into my localhost environment. Funny enough, it works just fine on my machine. It doesn't even throw errors locally. However, it doesn't work online. What the heck is going on?
The only differences I can think of between the two environments are the php versions and sql database versions (xampp is newer)...but I don't know if that really makes a difference because the script USED to work on my server, so it must be compatible with the set versions.
I've been editing the files in the script for quite a while now. I know when I first started, the uploads would work just fine. Then I didn't upload for a while because I already tested it out and knew it worked, so I just continued working on the script. I may have modified something that's now causing the errors. But then wouldn't that cause the localhost environment to fail too? If the files are exactly the same, how could one fail to work? That makes no sense at all. I'm looking at this code lost and hopeless. I'm getting sad.
If ANYONE has any suggestions on fixing this, PLEASE let me know. I don't know what to do anymore.
If you need me to upload any of the other files, just ask.
Here are the error logs from the server:
PHP Notice: Undefined index: name in .../public_html/include/p-page-ask.php on line 126, referer:mydomain.com/submit
...public_html/submit: No such file or directory WARNING: .../public_html/submit: Can't access file Here's the code for the page with the notice: <?php if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser header('Location: ../'); exit; } require_once QA_INCLUDE_DIR.'p-app-format.php'; require_once QA_INCLUDE_DIR.'p-app-limits.php'; require_once QA_INCLUDE_DIR.'p-db-selects.php'; require_once QA_INCLUDE_DIR.'p-util-sort.php'; // Check whether this is a follow-on question and get some info we need from the database $in=array(); $followpostid=qa_get('follow'); $in['categoryid']=qa_get_category_field_value('category'); if (!isset($in['categoryid'])) $in['categoryid']=qa_get('cat'); $userid=qa_get_logged_in_userid(); list($categories, $followanswer, $completetags)=qa_db_select_with_pending( qa_db_category_nav_selectspec($in['categoryid'], true), isset($followpostid) ? qa_db_full_post_selectspec($userid, $followpostid) : null, qa_db_popular_tags_selectspec(0, QA_DB_RETRIEVE_COMPLETE_TAGS) ); if (!isset($categories[$in['categoryid']])) $in['categoryid']=null; if (@$followanswer['basetype']!='A') $followanswer=null; // Check for permission error $permiterror=qa_user_maximum_permit_error('permit_post_q', QA_LIMIT_QUESTIONS); if ($permiterror) { $qa_content=qa_content_prepare(); // The 'approve', 'login', 'confirm', 'limit', 'userblock', 'ipblock' permission errors are reported to the user here // The other option ('level') prevents the menu option being shown, in qa_content_prepare(...) switch ($permiterror) { case 'login': $qa_content['error']=qa_insert_login_links(qa_lang_html('question/ask_must_login'), qa_request(), isset($followpostid) ? array('follow' => $followpostid) : null); break; case 'confirm': $qa_content['error']=qa_insert_login_links(qa_lang_html('question/ask_must_confirm'), qa_request(), isset($followpostid) ? array('follow' => $followpostid) : null); break; case 'limit': $qa_content['error']=qa_lang_html('question/ask_limit'); break; case 'approve': $qa_content['error']=qa_lang_html('question/ask_must_be_approved'); break; default: $qa_content['error']=qa_lang_html('users/no_permission'); break; } return $qa_content; } // Process input $captchareason=qa_user_captcha_reason(); $in['title']=qa_post_text('title'); // allow title and tags to be posted by an external form $in['extra']=qa_opt('extra_field_active') ? qa_post_text('extra') : null; $in['tags']=qa_get_tags_field_value('tags'); if (qa_clicked('doask')) { require_once QA_INCLUDE_DIR.'p-app-post-create.php'; require_once QA_INCLUDE_DIR.'p-util-string.php'; $categoryids=array_keys(qa_category_path($categories, @$in['categoryid'])); $userlevel=qa_user_level_for_categories($categoryids); $in['notify']=qa_post_text('notify') ? true : false; $in['email']=qa_post_text('email'); $in['queued']=qa_user_moderation_reason($userlevel) ? true : false; qa_get_post_content('editor', 'content', $in['editor'], $in['content'], $in['format'], $in['text']); $errors=array(); if (!qa_check_form_security_code('ask', qa_post_text('code'))) $errors['page']=qa_lang_html('misc/form_security_again'); else { $filtermodules=qa_load_modules_with('filter', 'filter_question'); foreach ($filtermodules as $filtermodule) { $oldin=$in; $filtermodule->filter_question($in, $errors, null); qa_update_post_text($in, $oldin); } if (qa_using_categories() && count($categories) && (!qa_opt('allow_no_category')) && !isset($in['categoryid'])) $errors['categoryid']=qa_lang_html('question/category_required'); // check this here because we need to know count($categories) elseif (qa_user_permit_error('permit_post_q', null, $userlevel)) $errors['categoryid']=qa_lang_html('question/category_ask_not_allowed'); if ($captchareason) { require_once 'p-app-captcha.php'; qa_captcha_validate_post($errors); } if (empty($errors)) { $cookieid=isset($userid) ? qa_cookie_get() : qa_cookie_get_create(); // create a new cookie if necessary $questionid=qa_question_create($followanswer, $userid, qa_get_logged_in_handle(), $cookieid, $in['title'], $in['content'], $in['format'], $in['text'], qa_tags_to_tagstring($in['tags']), $in['notify'], $in['email'], $in['categoryid'], $in['extra'], $in['queued'], $in['name']); qa_redirect(qa_q_request($questionid, $in['title'])); // our work is done here } } } // Prepare content for theme $qa_content=qa_content_prepare(false, array_keys(qa_category_path($categories, @$in['categoryid']))); $qa_content['title']=qa_lang_html(isset($followanswer) ? 'question/ask_follow_title' : 'question/ask_title'); $qa_content['error']=@$errors['page']; $editorname=isset($in['editor']) ? $in['editor'] : qa_opt('editor_for_qs'); $editor=qa_load_editor(@$in['content'], @$in['format'], $editorname); $field=qa_editor_load_field($editor, $qa_content, @$in['content'], @$in['format'], 'content', 12, false); $field['label']=qa_lang_html('question/q_content_label'); $field['error']=qa_html(@$errors['content']); $custom=qa_opt('show_custom_ask') ? trim(qa_opt('custom_ask')) : ''; $qa_content['form']=array( 'tags' => 'name="ask" method="post" action="'.qa_self_html().'"', 'style' => 'tall', 'fields' => array( 'custom' => array( 'type' => 'custom', 'note' => $custom, ), 'title' => array( 'label' => qa_lang_html('question/q_title_label'), 'tags' => 'name="title" id="title" autocomplete="off"', 'value' => qa_html(@$in['title']), 'error' => qa_html(@$errors['title']), ), 'similar' => array( 'type' => 'custom', 'html' => '<span id="similar"></span>', ), 'content' => array( 'tags' => 'name="content" id="content" autocomplete="off" class="hide"', 'value' => qa_html(@$in['content']), 'error' => qa_html(@$errors['content']), ), 'imgupload' => array( 'type' => 'custom', 'html' => '<label class="imguploadbtn" for="checkbox-menu3">Upload image</label>', ), 'imgprev' => array( 'type' => 'custom', 'html' => '<div class="imgprev"><img id="imgprev" />or</div>', ), 'imgurl' => array( 'type' => 'custom', 'html' => '<input id="imgurl" placeholder="image url" type="text" autocomplete="off" ><input type="checkbox" name="check1" id="imgurlc" class="hide" onclick="copyTextValue();"/> <label class="imgurlb" for="imgurlc">Add</label><script>$("#imgurl").on({ keydown: function(e) { if (e.which === 32) return false; }, change: function() { this.value = this.value.replace(/\s/g, ""); } });</script>', ), ), 'buttons' => array( 'ask' => array( 'tags' => 'onclick="qa_show_waiting_after(this, false); '. (method_exists($editor, 'update_script') ? $editor->update_script('content') : '').'"', 'label' => qa_lang_html('question/ask_button'), ), ), 'hidden' => array( 'editor' => qa_html($editorname), 'code' => qa_get_form_security_code('ask'), 'doask' => '1', ), ); if (!strlen($custom)) unset($qa_content['form']['fields']['custom']); if (qa_opt('do_ask_check_qs') || qa_opt('do_example_tags')) { $qa_content['script_rel'][]='p-content/p-ask.js?'.QA_VERSION; $qa_content['form']['fields']['title']['tags'].=' onchange="qa_title_change(this.value);"'; if (strlen(@$in['title'])) $qa_content['script_onloads'][]='qa_title_change('.qa_js($in['title']).');'; } if (isset($followanswer)) { $viewer=qa_load_viewer($followanswer['content'], $followanswer['format']); $field=array( 'type' => 'static', 'label' => qa_lang_html('question/ask_follow_from_a'), 'value' => $viewer->get_html($followanswer['content'], $followanswer['format'], array('blockwordspreg' => qa_get_block_words_preg())), ); qa_array_insert($qa_content['form']['fields'], 'title', array('follows' => $field)); } if (qa_using_categories() && count($categories)) { $field=array( 'label' => qa_lang_html('question/q_category_label'), 'error' => qa_html(@$errors['categoryid']), ); qa_set_up_category_field($qa_content, $field, 'category', $categories, $in['categoryid'], true, qa_opt('allow_no_sub_category')); if (!qa_opt('allow_no_category')) // don't auto-select a category even though one is required $field['options']['']=''; qa_array_insert($qa_content['form']['fields'], 'content', array('category' => $field)); } $field=array( 'label' => qa_html(qa_opt('extra_field_prompt')), 'tags' => 'name="extra" placeholder="image url" id="extra" class="hide"', 'value' => qa_html(@$in['extra']), 'error' => qa_html(@$errors['extra']), ); qa_array_insert($qa_content['form']['fields'], null, array('extra' => $field)); if (qa_using_tags()) { $field=array( 'error' => qa_html(@$errors['tags']), ); qa_set_up_tag_field($qa_content, $field, 'tags', isset($in['tags']) ? $in['tags'] : array(), array(), qa_opt('do_complete_tags') ? array_keys($completetags) : array(), qa_opt('page_size_ask_tags')); qa_array_insert($qa_content['form']['fields'], null, array('tags' => $field)); } if (!isset($userid)) qa_set_up_name_field($qa_content, $qa_content['form']['fields'], @$in['name']); if ($captchareason) { require_once 'p-app-captcha.php'; qa_set_up_captcha_field($qa_content, $qa_content['form']['fields'], @$errors, qa_captcha_reason_note($captchareason)); } $qa_content['focusid']='title'; return $qa_content; /* Omit PHP closing tag to help avoid accidental output */ Hello everyone, In fact, I have a script that makes the crop image that works well, I'm stuck on the part of adding a text box to allow to name the image "thumb". I also ask if possible to remove the "PHP_SELF" script and divide it into several pages. Attached script I'm wondering what makes a pop-up login window run differently than inside a webpage. I can't seem to get my login system to bring the user back to the page (brings them to a page can't be found) when clicking a form submit button when it is included in the webpage. But if your in the popup page that I'm trying to include, it works no problem so I was wondering if it changes anything. Or if there is some sort of work around (such as embedding a popup window into the webpage). Thanks a lot! I am creating a form that will allow the user to select the make of vehicle "FORD" for example. If that make of vehicle is selected among different makes of vehicles, then another box will appear, with all the models for that particular model "Fiesta" for example. What type of code accomplishes this setup in my web page? I do not want to list 500 models in one drop down list, but just those for each make in the first drop down list. Thanks much! Hi, I have some code which displays my blog post in a foreach loop, and I want to add some social sharing code(FB like button, share on Twitter etc.), but the problem is the way I have my code now, creates 3 instances of the sharing buttons, but if you like one post, all three are liked and any thing you do affects all of the blog post. How can I fix this? <?php include ("includes/includes.php"); $blogPosts = GetBlogPosts(); foreach ($blogPosts as $post) { echo "<div class='post'>"; echo "<h2>" . $post->title . "</h2>"; echo "<p class='postnote'>" . $post->post . "</p"; echo "<span class='footer'>Posted By: " . $post->author . "</span>"; echo "<span class='footer'>Posted On: " . $post->datePosted . "</span>"; echo "<span class='footer'>Tags: " . $post->tags . "</span>"; echo ' <div class="addthis_toolbox addthis_default_style "> <a class="addthis_button_facebook_like" fb:like:layout="button_count"></a> <a class="addthis_button_tweet"></a> <a class="addthis_counter addthis_pill_style"></a> </div> <script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script> <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=webguync"></script>'; echo "</div>"; } ?> I have the following code in html: <html> <head> <script type="text/javascript"> <!-- function delayer(){ window.location = "http://VARIABLEVALUE.mysite.com" } //--> </script> <title>Redirecting ...</title> </head> <body onLoad="setTimeout('delayer()', 1000)"> <script type="text/javascript"> var sc_project=71304545; var sc_invisible=1; var sc_security="9c433fretre"; </script> <script type="text/javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript> <div class="statcounter"><a title="vBulletin statistics" href="http://statcounter.com/vbulletin/" target="_blank"><img class="statcounter" src="http://c.statcounter.com/71304545/0/9c433fretre/1/" alt="vBulletin statistics" ></a></div></noscript> </body> </html> Is a basic html webpage with a timer redirect script and a stascounter code. I know a bit about html and javascript, but almost nothing about php. My question is: How a can convert this html code into a php file, in order to send a variable value using GET Method and display this variable value inside the javascript code where says VARIABLEVALUE. Thanks in adavance for your help. Advance thank you. Can you help please. The error..... Warning: mysql_fetch_assoc() expects parameter 1 to be resource, string given in C:\wamp\www\test_dabase.php on line 24 code. Code: [Select] <?php //database connection. $DB = mysql_connect("localhost","root") or die(mysql_error()); if($DB){ //database name. $DB_NAME="mysql"; //select database and name. $CON=mysql_select_db($DB_NAME,$DB)or die(mysql_error()."\nPlease change database name"); // if connection. }if($CON){ //show tables. $mysql_show="SHOW TABLES"; //select show and show. $mysql_select2="mysql_query(".$mysql_show.") or die(mysql_error())"; } //if allowed to show. if($mysql_select2){ //while it and while($data=mysql_fetch_assoc($mysql_select2)){ //show it. echo $data; } } ?> Hi, I need to insert some code into my current form code which will check to see if a username exist and if so will display an echo message. If it does not exist will post the form (assuming everything else is filled in correctly). I have tried some code in a few places but it doesn't work correctly as I get the username message exist no matter what. I think I am inserting the code into the wrong area, so need assistance as to how to incorporate the username check code. $sql="select * from Profile where username = '$username'; $result = mysql_query( $sql, $conn ) or die( "ERR: SQL 1" ); if(mysql_num_rows($result)!=0) { process form } else { echo "That username already exist!"; } the current code of the form <?PHP //session_start(); require_once "formvalidator.php"; $show_form=true; if (!isset($_POST['Submit'])) { $human_number1 = rand(1, 12); $human_number2 = rand(1, 38); $human_answer = $human_number1 + $human_number2; $_SESSION['check_answer'] = $human_answer; } if(isset($_POST['Submit'])) { if (!isset($_SESSION['check_answer'])) { echo "<p>Error: Answer session not set</p>"; } if($_POST['math'] != $_SESSION['check_answer']) { echo "<p>You did not pass the human check.</p>"; exit(); } $validator = new FormValidator(); $validator->addValidation("FirstName","req","Please fill in FirstName"); $validator->addValidation("LastName","req","Please fill in LastName"); $validator->addValidation("UserName","req","Please fill in UserName"); $validator->addValidation("Password","req","Please fill in a Password"); $validator->addValidation("Password2","req","Please re-enter your password"); $validator->addValidation("Password2","eqelmnt=Password","Your passwords do not match!"); $validator->addValidation("email","email","The input for Email should be a valid email value"); $validator->addValidation("email","req","Please fill in Email"); $validator->addValidation("Zip","req","Please fill in your Zip Code"); $validator->addValidation("Security","req","Please fill in your Security Question"); $validator->addValidation("Security2","req","Please fill in your Security Answer"); if($validator->ValidateForm()) { $con = mysql_connect("localhost","uname","pw") or die('Could not connect: ' . mysql_error()); mysql_select_db("beatthis_beatthis") or die(mysql_error()); $FirstName=mysql_real_escape_string($_POST['FirstName']); //This value has to be the same as in the HTML form file $LastName=mysql_real_escape_string($_POST['LastName']); //This value has to be the same as in the HTML form file $UserName=mysql_real_escape_string($_POST['UserName']); //This value has to be the same as in the HTML form file $Password= md5($_POST['Password']); //This value has to be the same as in the HTML form file $Password2= md5($_POST['Password2']); //This value has to be the same as in the HTML form file $email=mysql_real_escape_string($_POST['email']); //This value has to be the same as in the HTML form file $Zip=mysql_real_escape_string($_POST['Zip']); //This value has to be the same as in the HTML form file $Birthday=mysql_real_escape_string($_POST['Birthday']); //This value has to be the same as in the HTML form file $Security=mysql_real_escape_string($_POST['Security']); //This value has to be the same as in the HTML form file $Security2=mysql_real_escape_string($_POST['Security2']); //This value has to be the same as in the HTML form file $sql="INSERT INTO Profile (`FirstName`,`LastName`,`Username`,`Password`,`Password2`,`email`,`Zip`,`Birthday`,`Security`,`Security2`) VALUES ('$FirstName','$LastName','$UserName','$Password','$Password2','$email','$Zip','$Birthday','$Security','$Security2')"; //echo $sql; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } else{ mail('email@gmail.com','A profile has been submitted!',$FirstName.' has submitted their profile',$body); echo "<h3>Your profile information has been submitted successfully.</h3>"; } mysql_close($con); $show_form=false; } else { echo "<h3 class='ErrorTitle'>Validation Errors:</h3>"; $error_hash = $validator->GetErrors(); foreach($error_hash as $inpname => $inp_err) { echo "<p class='errors'>$inpname : $inp_err</p>\n"; } } } if(true == $show_form) { ?> hey gurus, i am a newbie php coder.. i am learning by example. what i am trying to do is write a piece of code which will alter 3 tables (user, bonus_credit, bonus_credit_usage) ---------------------------------------------------------------- the table structure that will be used is as follows: user.bonus_credit user.ID bonus_credit.bonusCode bonus_credit.qty bonus_credit.value bonus_credit_usage.bonusCode bonus_credit_usage.usedBy ---------------------------------------------------------------- so lets say, in bonus_credit i have the following bonusCode = 'facebook' (this is the code they have to type to redeem the bonus qty = '10' ( number of times the bonusCode can be redeemed, but same person can't redeem it more than once) value = '5' (this is the amount of bonus_credit for each qty) Now, I need to write a code that check to see if the code has been redeemed in the bonus_credit_usage table and if the user.ID exists in this table as bonus_code_usage.usedBy, then give an error that its already been used and if it hasn't been used, then subtract 1 from qty, add ID to usedBy and then add the value to the bonus_credit ----------------------- i have started the steps just to create a simple textbox and entering a numeric value to bonus_credit, and that works.. but now i have to use JOIN and IF and ELSE.. which is a little too advanced for me.. so i'd appreciate a guide as i write the code. if(isset($_REQUEST['btnBonus'])) { $bonus_credit = addslashes($_REQUEST['bonusCode']); $query = "update user set bonus_credit=bonus_credit+'".$bonus_credit."' where id='".$_SESSION['SESS_USERID']."'"; echo "<script>window.location='myreferrals.php?msgs=2';</script>"; mysql_query($query) or die(mysql_error()); } Hi, Look at this code below: Code: [Select] <?php function outputModule($moduleID, $moduleName, $sessionData) { if(!count($sessionData)) { return false; } $markTotal = 0; $markGrade = 0; $weightSession = 0; $grade = ""; $sessionsHTML = ""; foreach($sessionData as $session) { $sessionsHTML .= "<p><strong>Session:</strong> {$session['SessionId']} <strong>Session Mark:</strong> {$session['Mark']}</strong> <strong>Session Weight Contribution</strong> {$session['SessionWeight']}%</p>\n"; $markTotal += round($session['Mark'] / 100 * $session['SessionWeight']); $weightSession += ($session['SessionWeight']); $markGrade = round($markTotal / $weightSession * 100); if ($markGrade >= 70) { $grade = "A"; } else if ($markGrade >= 60 && $markGrade <= 69) { $grade = "B"; } else if ($markGrade >= 50 && $markGrade <= 59) { $grade = "C"; } else if ($markGrade >= 40 && $markGrade <= 49) { $grade = "D"; } else if ($markGrade >= 30 && $markGrade <= 39) { $grade = "E"; } else if ($markGrade >= 0 && $markGrade <= 29) { $grade = "F"; } $moduleHTML = "<p><br><strong>Module:</strong> {$moduleID} - {$moduleName} <strong>Module Mark:</strong> {$markTotal} <strong>Mark Percentage:</strong> {$markGrade} <strong>Grade:</strong> {$grade} </p>\n"; return $moduleHTML . $sessionsHTML; } $output = ""; $studentId = false; $courseId = false; $moduleId = false; while ($row = mysql_fetch_array($result)) { if($studentId != $row['StudentUsername']) { //Student has changed $studentId = $row['StudentUsername']; $output .= "<p><strong>Student:</strong> {$row['StudentForename']} {$row['StudentSurname']} ({$row['StudentUsername']})\n"; } if($courseId != $row['CourseId']) { //Course has changed $courseId = $row['CourseId']; $output .= "<br><strong>Course:</strong> {$row['CourseId']} - {$row['CourseName']} <strong>Course Mark</strong> <strong>Grade</strong> <br><strong>Year:</strong> {$row['Year']} </p>\n"; } if($moduleId != $row['ModuleId']) { //Module has changed if(isset($sessionsAry)) //Don't run function for first record { //Get output for last module and sessions $output .= outputModule($moduleId, $moduleName, $sessionsAry); } //Reset sessions data array and Set values for new module $sessionsAry = array(); $moduleId = $row['ModuleId']; $moduleName = $row['ModuleName']; } //Add session data to array for current module $sessionsAry[] = array('SessionId'=>$row['SessionId'], 'Mark'=>$row['Mark'], 'SessionWeight'=>$row['SessionWeight']); } //Get output for last module $output .= outputModule($moduleId, $moduleName, $sessionsAry); //Display the output echo $output; } } } ?> This code allallows me to make calculations and display a student's course and linked with it the course the modules in the course and linked with modules are all the sessions. It is able to display what marks each student have got for each module and session. Now look at code below, it is able to display modules and in those modules the sessions that link to those modules: Code: [Select] <?php if($moduleId != $row['ModuleId']) { //Module has changed if(isset($sessionsAry)) //Don't run function for first record { //Get output for last module and sessions $output .= outputModule($moduleId, $moduleName, $sessionsAry); } //Reset sessions data array and Set values for new module $sessionsAry = array(); $moduleId = $row['ModuleId']; $moduleName = $row['ModuleName']; } //Add session data to array for current module $sessionsAry[] = array('SessionId'=>$row['SessionId'], 'Mark'=>$row['Mark'], 'SessionWeight'=>$row['SessionWeight']); } What I want to know is how can I do something similar for course so that it picks out the right modules depending on the course it displays. There maybe some code that needs to be added in the function. Can I combine also HTML code in PHP function? For example, can a PHP function include HTML form and the PHP code to handle this form? If yes, this will make my main code much more smaller and readable. If not, is there a way to define an "external macro" like, which allow me to replace pre-defined lines of code with short alias? I use this type of a code to send automatic emails from my website: Code: [Select] $headers = ; $headers .= ; $to = ; Click here to go to Google. ", $headers); I am having hard time figuring out how to do hyperlink on words (like here). If I do something like this: Code: [Select] <a href='http://www.google.com'>here</a> it spits out that exact thing out. Thanks you for your input Can you help me integrate this code :
<form method="post" action="submit.php"> <input type="checkbox" class="required" /> Click to check <br /> <input disabled="disabled" type='submit' id="submitBtn" value="Submit"> </form>In to this Contact Form code, please? <form action="../page.php?page=1" method="post" name="contact_us" onSubmit="return capCheck(this);"> <table cellpadding="5" width="100%"> <tr> <td width="10" class="required_field">*</td> <td width="80">Your Name</td> <td><input type="text" name="name" maxlength="40" style="width:400px;/></td> </tr> <tr> <td class="required_field">*</td> <td>Email Address</td> <td><input type="text" name="email" maxlength="40" style="width:400px;/></td> </tr> <tr> <td></td> <td>Comments:</td> <td><textarea name="comments" style="width: 400px; height: 250px;"></textarea></td> </tr> </table> </form Hello Everyone I am new to php and indeed Web Development. After testing and Playing a bit, I can get the following code to work as two files, the form calling the *.php file to insert into the database, however, I am trying to create one html/php file that displays the form and then executes the php code to insert into the database once user clickes the button. Please can you assist me with the code? I have something horribly wrong and I cannot find it. Code: [Select] <?php> <html> <head> <title>Personal Details</title> </head> <body> <form method="post" action="contactdetails.html"><font face="Arial"> Call Sign:<br> <input name="callsign" size="5" type="text"><br> Surame:<br> <input name="surname" size="30" type="text"><br> First Name:<br> <input name="firstnames" size="30" type="text"><br> Known as:<br> <input name="knownas" size="30" type="text"><br> RSA ID No.:<br> <input name="rsaid" size="13" type="text"><br> Birth Date:<br> <input name="birthdate" size="12" type="text"><br> <input name="Insert" value="Next" type="submit"></form> </font><br> </body> </html> //php to insert data into table $callsign = $_POST['callsign']; $surname = $_POST['surname']; $firstnames = $_POST['firstnames']; $knownas = $_POST['knownas']; $rsaid = $_POST['rsaid']; $birthdate = $_POST['birthdate']; mysql_connect ("localhost", "jredpixm_testuse", "PHPDevelopment") or die ('I cannot connect to the database because: ' .mysql_error()); mysql_select_db ("jredpixm_test"); $query="INSERT INTO personal_details (callsign, surname, firstnames, knownas, rsaid, birthdate)Values ('$callsign', '$surname', '$firstnames', '$knownas', '$rsaid', '$birthdate')"; mysql_query($query) or die ('Error updating Database'); echo "<p>Thanks, your information has been added to the database.</p>"; ?> Regards Allen How can I make sure that when I submit an new form and new ID (record) is created it is always 4-Digits. record 14 = 0014, record 225 = 0225. Thanks |