Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8416139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:39:33+00:00 2026-06-10T01:39:33+00:00

I have a html form with multiple input fields, a name and an address

  • 0

I have a html form with multiple input fields, a name and an address for a customer. when the user submits the form the values in these fields are sent into a database made up of 2 tables.

I also have a drop down box with the options ‘yes, and ‘no’. when the form is submitted with ‘no’ selected I need the values to get sent to the database as normal but then instead of clearing the input fields for a new entry I need name and last name to grey out / become read only and keep the values that the user entered in them. while the address fields reset for a new entry.

The user can then enter new values in the address fields and press submit again where these will get added to the address table of my database with the customer Id of the name/lastname they previously entered.

this will be repeated until they press a different button on the form that then sends the final address and resets the entire form for a new customer entry.

So far I have it setup so a user can enter the customer name and address and press submit, it will then get send to the database and the form will reset for another customer entry.

This is my form, with 4 entry fields,

<form name="add" method="post" action="newCustomer.php">
<div id="leftcol">
<label><span>Name</span><br /> <input type="text" name="addFname" /></label>
<label><span>Surname</span> <input type="text" name="addLname" /> </label>
<label><span>Single Site?</span><Select name="field" onchange="showHide(this.value)

</label>
<div id="rightcol">
<label><span>Address line 1</span><input type="text" name="addSiteLine1" /></label>
<label><span>Address line 2</span><input type="text" name="addSiteLine2" /></label>

So far i have tried to add this to the bottom of my php code

if($dropdown== "no"){
     disable_text(true);

     }

disable text is a javascript function that disables the text, but this didn’t do anything.

I also tried to call this function upon form submit but then that stopped my $_POST methods from obtaining the values. when I set tried this again using read-only instead of disabled nothing seemed to happen.

I am basically trying to avoid needing a second form / webpage for adding customer addresses and trying to avoid adding multiple input boxes for multiple addresses ( because some may have 100+ addresses)

EDIT

$Dropdown is defined in the php as:

$dropdown = $_POST['field'];

in the form as

<label><span>Single Site?</span><Select name="field" onchange="showHide(this.value);">
</label>
<Option value="yes">yes</option>
<Option value="no">no</option>

the function was being called, when the function disabled all of the text fields I could see it happen, they would flash grey then the page would refresh and I would get error messages saying that

    $fName = $_POST['addFname'];

could not be defined. when I changed the function to make the fields readonly nothing seemed to happen, it would just submit the data and clear the form ready for a new input.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T01:39:35+00:00Added an answer on June 10, 2026 at 1:39 am

    I may not understand the question so correct me if I am wrong. Can’t you just disable the fields with javascript and save the field values in session variables to carry back to the form?

    document.getElementById('fieldToDisable').style.disabled= 'true';
    

    Make a session variable flag and if that is set on page load then refill the form and disable the fields.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's assume I have a form with these fields (HTML) <input type=text name=user[name] value=name/>
I have an HTML form that needs multiple submit buttons, like this: <input type=submit
I have a html form <form action=process.php method=post> <input type=checkbox name=name[v1] /> <input type=checkbox
I've got this HTML form where I have multiple input elements: text, radio, and
I have a form which has multiple input fields, and 3 main options. depending
I have a content submission form that contains multiple fields for input, all of
I have multiple forms, and I want to send classnames of these HTML form's
I have html form with arrays: <form method=post id=formaa name=form> <div id=fields> <div id=divas1
I have a form with multiple fields, and each time the user changes a
I have a fairly complex html form enhanced via jquery. It has multiple tabs,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.