Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About holy24

  • Rank
  1. Hi, I have a form with drop down list for user to submit, and I can allow the user to edit the data afterward. Now, when the user try to edit, the drop down option that they choose previously should automatically be retrieved. Example: 1. User submit the form with Accountancy as industry. 2. Next, user click edit button, the "Accountancy" should shown automatically in the industry field. Problem: 1. If the user choose 'Others' as industry, there will be a textbox for him to enter. 2. I need that when user edit the form, the form will show "Others" in the industry and the te
  2. Hi,I have created 2 fields in a table (month & year). The month will be shown as January,February,March etc. The year will be shown as 2011,2012 etc.The following is the code that will capture the date format once user submit a form. <?php$jd=cal_to_jd(CAL_GREGORIAN,date("m"),date("d"),date("Y"));$Month=jdmonthname($jd,1);$Year=date(Y);mysql_query ("INSERT INTO Table1 (month,year) VALUES ('$Month','$Year')");?>Now, I have a problem in sorting the month in descending order (December,November,October etc). Can someone please kindly help me on the sorting and I need to make the month
  3. holy24

    If else statement

    Hi, I have created a form for user to fill and I need to ensure that some fields are filled in with the necessary requirements. Example: Identification number (9 alphabet/numberic) - S1234567A Can someone kindly advice how can I ensure that only 9 alphabet/numberic is keyed by user? I understand that using sql statement there is a WHERE clause with Like operator (identification LIKE '_________') Can it be done using if else statement? if (identification LIKE '_________'){ alert("You have not entered correct Identification number"); return false; }
  4. Hi, I have tried re-writing the codes, but I have no idea how to code inside the showfield part. By default, product field will not be shown and when user click a vendor name, only all the products belong to that vendor will be shown. Can someone please kindly advise? Thanks. Below are the database design and the codes. Database:I created 1 database with 2 tables:1) Table named "vendor" with fields - id (primary key, auto-increment) and vendorname2) Table named "product" with fields - id (primary key, auto-increment), productname, vendorid (this will be the foreign key that link to the id in
  5. Hi, I am trying to do an invoice, and I have been using float/absolute positioning etc but I still cant get the format I want. Can someone please kindly help me? Thanks. Attached example on the layout. Invoice layout.doc
  6. Hi, I have created a form and when user select the drop-down list in column A, column B will show a drop-down list of values based on column A selection. I have written the code below with only 2 values in column A, however if there is more values in column A, I have to create alot of div id for each value. Can someone please kindly advice how can I simplified the codes? Thanks.
  7. Hi, I have been reading this function document.getElementsByTagName but still do not understand how it work. I have tried implementing it on my existing code but it seems not working. Can kindly explain on this? Thanks. function validateForm(){var x=document.getElementsByTagName('name');var y=document.getElementsByTagName('company');var z=document.getElementsByTagName('address');if (x=="" || x==null){alert("Please fill in name field!");return false;}else if (y=="" || y==null){alert("Please fill in company field!");return false;}else if (z=="" || z==null){alert("Please fill in address field!");
  8. Hi, I have problem showing table border line when a field is empty. I tried using css: table{empty-cells:show;} but the border line still wont show. Can anyone please kindly help on this? Thanks. <html><head><link rel="stylesheet" type="text/css" href="style.css" /></head> <body><table align="center" border="1"> <tr> <td><b>Name</b></td> <td><b>Address</b></td> <td><b>Contact</b></td> </tr> <tr> <td><?php echo $row1['name']; ?></td>
  9. Thanks everyone for the advice. @justsomeguy: Just to confirm if my understanding as below is correct? So I need to use a unique session name once for each website in the same host? Example:1. http://testing/folder1/index.phpa) In folder1, i will create a config.php and call it at the start of each file. 2. http://testing/folder2/index.phpa) In folder2, i will create a config.php and call it at the start of each file.
  10. Hi, I have created a logout page with session destroy and it will destroy the session upon logout. But if user did not do a logout there will be a problem. Eg. I login to my first website (eg. http://testing/folder1/index.php) and did not logout, then I login to another website (eg. http://testing/folder2/index.php) and did not logout. Then when i refresh my first website, the session["number"] i used in my first web application capture the session["number"] in my second web application. I suppose as you mentioned it is because both are on the same host (testing) and it could be possible to do
  11. Hi, I have been trying to use $_SESSION when a user successfully login to a website (eg. abc.com), but I am not sure why when I login another website(eg. zzz.com) simutanuously, it capture zzz.com details and show in abc.com. Steps to reproduce:1. Login to abc.com2. Upon successful login, in home.php, i echo the $_SESSION["number"] . It correctly shows the staff's number (eg. E123).---------------------------------login.php-------------------------------------session_start(); $login=mysql_query("SELECT * FROM staff WHERE (username = '" . mysql_real_escape_string($_POST['username']) . "') and (
  12. Hi, I have re-write using my 1st code and now the layout looks fine and able to insert into the database. Now, I am trying to prompt user to fill in the field if it is blank. For the default first row, I am able to do so. But I am not sure why the appendchild fields are not prompting the user when field is empty upon submitting? Can kindly advice on this? Thanks. ---------------------------------------------<script type="text/javascript"> function validateForm(){var x=document.forms["form"]["name[]"].value;var y=document.forms["form"]["company[]"].value;var z=document.forms["form"]["addr
  13. Hi, The following codes now correctly shown a table with 1 row and 3 fields. When user click on "add", another row will appear. My question is: If user entered 3 rows of data, how can I capture all these data and insert into a database? I tried echoing and the outcome is always getting the last record. Can someone please kindly advice on this? Thanks. Example:formName | Company | AddressUser1 | Company 1 | Address 1User2 | Company 2 | Address 2User3 | Company 3 | Address 3 database Name | Company | AddressUser1 | Company 1 | Address 1User2 | Company 2 | Address 2User3
  14. Hi, I am trying to create a form in a table format whereby there are 1 row and 3 columns(1 field in each column). There will be a "Add" button, and if user click on the button, another row will appear with the 3 fields. Below are the codes that I have wrote:- When user 1st view, they can see the table with header, 1 row with 3 fields, an add button- However, if user click on "Add" button, the 2nd row appear outside the table format. Can someone advise me how to make it appear inside the same table just after the 1st row? Thanks. <script type="text/javascript"> function addInput(divName
  15. holy24

    strtotime() function

    Thanks guys..The problem is solved.
  • Create New...