PHP form field not displayed [was: Beginner problem.]

Hello good people.

I have a very simple question.

Here's my index.html

< ! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "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 > Test PHP < /title >
< style >
{body
margin: 50px; background-color: #232323; do-family: without serif. color: #B7B7B7; font-size: 13px;
}
Input, textarea {}
border: 1px solid #464646; background-color: #1C1C1C; do-family: without serif. color: #CECECE; do-size: 10px; margin-top: 15px; margin-bottom: 15px;
}
{#submit}
font-size: 13px;
}
< / style >
< / head >

< body >
< do action = "index.php" method = "post" > "
What's your name? < br / >
< input type = "text" name = "name" / > < br / >
What is your age? < br / >
< input type = "text" name = "age" / > < br / >
< textarea type = "text" name = "tekstas" rows = "5" cols = "40" > your message. < / textarea > < br / > < br / >
< input type = "submit" value = "Go!" id = "submit" / >
< / make >
< / body >
< / html >

And index.php

<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > ""
" < html xmlns =" http://www.w3.org/1999/xhtml ">
< head >
< style >
{body
margin: 50px; background-color: #232323; do-family: without serif. color: #B7B7B7; font-size: 13px;
}
< / style >
< meta http-equiv = "Content-Type" content = text/html"; Charset = UTF-8 "/ >"
< title > PHP < /title > result
< / head >

< body >
<? PHP
SetType ($_POST ["age"], "integer");
echo 'your name is. " $_POST ['name']. "< br / > ';
If ($_POST ["age"]! = 0) echo "your age is." $_POST ['age']. "< br / > < br / > ';
"If ($_POST ["age"] = 0) echo"Please indicate your age."." < br / > < br / > ';

echo "< b > Message: < /b > < br / >". "." $_POST ['tekstas"];
? >
< / body >
< / html >

The question is:

Why the part of the age of php does not work properly? If I leave it black or type zero in the age < input >, PHP simply ignores the part 'Please specify your age' code.

You're relatively new to this forum. Welcome.

Please take a moment to read How to get help quickly. Using a subject like "Newbie problem" line makes no sense and is likely to be ignored at busy periods. Always try to use a descriptive subject line.

The answer to your problem is very simple. This is the error of the beginner town that attracts even more experienced people from time to time. It is in this line:

if ($_POST["age"]=0 ) echo "Please specify your age."."

";

You used only one sign "equal", which assigns the value to a variable, then it always equals TRUE.

To compare two values, you must use two equal signs like this:

if ($_POST["age"] == 0 ) echo "Please specify your age."."

";

There are other things that could be done to improve your code, but which solves the underlying problem.

Tags: Dreamweaver

Similar Questions

  • VB6 program install on Win7, but some forms will not display

    Using a Setup.exe to install the program on any Windows XP operating system or higher to run as administrator and all work to form properly.

    Customer wants to distribute through the .msi package:

    With the help of an .msi package built with Visual Studio 6 Installer on Windows XP.  Install on Windows XP and each form works correctly.

    Using the same name of the package .msi on Win7 and some forms are not displayed, no error is generated, the screen does not display.  I checked that all the controls are distributed and installed on the target computer.  I think it may be related to registration of MSADO15.dll or MSCOMCTL.ocx because the only thing that forms that do not have in common is that they use all ADO recordsets.

    Someone has ideas about things can try or I had a similar experience with applications on Win7 VB6?

    This really is... KS! THANK YOU MICROSOFT!

    I run a win 7 with office 2010 and all solustions here don't quite work.

    PLEASE I PREF. PEOPLE... MICROSOFT COMES UP WITH ANOTHER UPDATE WILL FIX THE PROBLEM

    Can someone help me please...

    after update from 15-08-2012 mscomctl.ocx no longer works

    Thank you people

    Hello people,

    I fixed it by restoring the system to 1 day before the update from 14 August.
    Then I did regsvr32.exe /s mscomctl.ocx to system32 and syswow64 folder

    It worked!

    I hope this will solve your problems too

  • Internet Adobe forms do not display the data in fields

    This form, linked to our database online, allowing to operate correctly when opening. Now, all fields are empty. The fields are visible by selecting the new option 'open with different Viewer' - but that downloads the form - which is not a step we want that the end user to have to do. Still once, several years of data in this form has been able to be viewed online - now he must open, then download it to view the fields filled. Why is this? What steps can we take our part to restore the end previous result to met data visible WITHOUT downloading the form fields?Untitled-1.jpg

    You must configure the browser to open PDF using Acrobat or Reader. You can see the top right button that will allow you to do. Firfox now has a built-in PDF reader, and it is not very good.

  • Re: Filled form fields not printing - using Acrobat Pro on Windows 10

    I have the same problem, except that there is no system of Mac involved. I've created a registration form to fill live events to a charitable organization for which I work and distributed. I had checked that filled in forms may be saved with their data, but I don't actually print a. Today, I downloaded the form inside and tried to print it. Fixed content of the form prints normally, but the content of the form fields is not printed. I have the print options configured to print 'Document and annotations', as suggested elsewhere. A test, I used Photoshop to open the file. It can be printed (default settings) with the fields filled in displayed as it should show. On my own system I open and print the latest version of Acrobat Professional. I also tried to print from another system, using Acrobat Reader DC - this has also led the white printing. Both systems are running Windows Update 10 anniversary. The original form (empty) can be downloaded from http://ncinvestiture.holysepulchre.net/images/regformnew.pdf. I can send you my completed form if you want to give me the necessary details.

    • Open the document in Acrobat Pro ms
    • use tools > form prepare
    • Double click on a form field
    • change the settings
    • continue with the next field
  • Adobe form does not display a comments or radio buttons on mobile devices

    I created a form with radio buttons and the comment fields.  I have coaches assess students.  When the student opens the screen on a PC, they see the buttons radio, comments very well.  Unfortunately, when they open a mobile under the radio buttons and the comments disappear.  I tested it, and if you open the file in the Adobe Reader application on the mobile it works, but not in preview the message mode.  I can't ask everyone to download the adobe reader app to see the eval, so the only other workaround that I thought was to export the pdf as an image file, so that they can display it on their mobile.  Export is several files image, which of course is heavy it trying to figure out which page is next etc. and for which eval.

    1. is there a way to create a form that will display correctly in preview on a mobile?  or

    2. is there a way to export a multiple page pdf in the file of an image? or

    3. Another idea?

    Thanks in advance for your help.

    I'm not quite clear on the question of if you try to export a form or before filling. If the form is filled on the Adobe Acrobat software for iOS, you can share the file (using the share button). The application will offer to the 'flatten' the form or send the original document. If you group the shape, it needs to be flattened so that the content would be visible from other applications (including remittances), but the form is no longer to fill.

  • Form does not display the 'new' SQL database records

    I have a PDF form that retrieves data from a SQL Server.  The fields of
    the PDF are filled from the database after you have selected a specific
    record in a menu drop down and clicking a button called 'bridge '.
    The problem is that the drop-down list does not display new records that
    have been recently added to the database.  I have to open the form
    in the designer, and then save it, (* note - I change anything at this point.)
    Then, when the form is opened upward in Adobe drop-down list show all
    the documents, including the new ones.  I even put a manual on refresh
    form to try to solve the computer problem has not helped. Seriously left speechless.

    Any help is greatly appreciated.


    Here is my code for the menu drop down.

    ++++++++++++++++++++++++++++

    topmostSubform.Page1.JobSelect::initialize - (JavaScript, client)
    var sDataConnectionName = "BBCC" example - var sDataConnectionName
    = 'Test ';
    var sColHiddenValue = "ContractAdmin_Key"; example - var
    sColHiddenValue = "Dept_ID";
    var sColDisplayText = "JobDescription". example - var
    sColDisplayText = "Dept_ID".

    Search for sourceSet node that match the name of DataConnection
    var nIndex = 0;
    While (xfa.sourceSet.nodes.item (nIndex) .name! = sDataConnectionName)
    {
    nIndex ++;

    }

    oDB var = xfa.sourceSet.nodes.item (nIndex);
    oDB.open ();
    oDB.first ();

    Search with the command 'class name' node
    var nDBIndex = 0;
    While (oDB.nodes.item (nDBIndex) .className! = 'command')
    {
    nDBIndex ++;

    }

    Save the original settings before you assign it, BOF and EOF to stay
    var sBOFBackup =
    oDB.nodes.item (nDBIndex).query.recordSet.getAttribute ("bofAction");
    var sEOFBackup =
    oDB.nodes.item (nDBIndex).query.recordSet.getAttribute ("eofAction");

    oDB.nodes.item (nDBIndex).query.recordSet.setAttribute ("stayBOF",
    "bofAction");
    oDB.nodes.item (nDBIndex).query.recordSet.setAttribute ("stayEOF",
    "eofAction");

    Clear list
    this.clearItems ();

    Find the record with the corresponding data connection name
    nIndex = 0;
    While (xfa.record.nodes.item (nIndex) .name! = sDataConnectionName)
    {
    nIndex ++;

    }

    var oRecord = xfa.record.nodes.item (nIndex);

    Find the value
    var oValueNode = null;
    var oTextNode = null;
    for (var nColIndex = 0; nColIndex < oRecord.nodes.length; nColIndex ++)
    {If (oRecord.nodes.item (nColIndex) .name is sColHiddenValue)
    {oValueNode = oRecord.nodes.item (nColIndex) ;} on the other
    If (oRecord.nodes.item (nColIndex) .name == sColDisplayText) {oTextNode
    = oRecord.nodes.item (nColIndex); } }

    While (!) ODB. IsEOF())
    {
    this.addItem (oTextNode.value, oValueNode.value);
    oDB.next ();

    }

    Restore the original settings
    oDB.nodes.item (nDBIndex).query.recordSet.setAttribute (sBOFBackup,
    "bofAction");
    oDB.nodes.item (nDBIndex).query.recordSet.setAttribute (sEOFBackup,
    "eofAction");

    Close connection
    oDB.close ();

    ++++++++++++++++++++++

    Here is the code for the button refresh

    +++++++++++++++++++++

    topmostSubform.Page1.Button27::click - (JavaScript, client)
    sourceSet.BBCC.requery ();

    +++++++++++++++++++++

    The other thing that could happen is a problem of refreshment in the DropDownList control. Try to add the command xfa.layout.relayout () after the database connection has been closed.

    Paul

  • State form field to display the drop-down list of all States

    My client has an interest in having the STATE form field in the withdrawal form store a string to a field conversion menu drop-down displays the list of States. He only sells to the United States, so there are 50 lists. I don't think it's necessary, but is it possible?

    Thanks for your time!

    Mouma

    Hi Jeff,

    As long as her select field name is the same as it is for the text field (and just good to do the same thing for ID) then you can change it.

    Options whose value. Then come by in admin.

    Note that if the customer ships internationally is not a viable edition.

  • Create the calculated in PHP form field

    Hello

    I am trying to create a calculated field that will take care of the average of the ratings when a form is entered. This field will then submit the average value and the shape at the end (that's why I need the value to calculate before sending the form - that is, as the form is filled out).

    I found the following code (designed for HTML forms rather than PHP forms, but I hope that it might work). It doesn't seem to do anything - the field displays no information. Help?

    < script language = javascript >

    < !--/ /

    function dm (amount)

    {

    String = ' ' + amount;

    DEC = string.length - string.indexOf('.');

    If (string.indexOf('.') == - 1).

    Returns the string + '. 00';

    If (dec == 1)

    return string + ' 00 ";

    If (dec == 2)

    return string + '0';

    If (dec 3)

    return string.substring(0,string.length-dec+3);

    Returns the string;

    }

    function calculate)

    {

    Opp1 = 0;  Inv1 = 0;  COM1 = 0;  wlb1 = 0;  COM2 = 0;  Atm1 = 0;  PAR1 = 0;  Increase 1 = 0;  Rew1 = 0;  Env1 = 0;  Gro1 = 0;

    If (document.form1.Opportunity.value > "")

    {Opp1 = document.form1.Opportunity.value};

    document. Form1.opportunity.value = eval (Opp1);

    If (document.form1.Investment.value > "")

    {Inv1 = document.form1.Investment.value};

    document. Form1.investment.value = eval (Inv1);

    If (document.form1.Community.value > "")

    {Com1 = document.form1.Community.value};

    document.Form1.Community.Value = eval (Com1);

    If (document.form1.WLB.value > "")

    {wlb1 = document.form1.WLB.value};

    document. Form1.WLB.value = eval (wlb1);

    If (document.form1.Communication.value > "")

    {Com2 = document.form1.Communication.value};

    document.Form1.communication.Value = eval (Com2);

    If (document.form1.Atmosphere.value > "")

    {Atm1 = document.form1.Atmosphere.value};

    document. Form1.atmosphere.value = eval (Atm1);

    If (document.form1.Performance.value > "")

    {PAR1 = document.form1.Performance.value};

    document. Form1.performance.value = eval (Per1);

    If (document.form1.Inclusion.value > "")

    {Increase 1 = document.form1.Inclusion.value};

    document. Form1.inclusion.value = eval (Inc1);

    If (document.form1.Rewards.value > "")

    {Rew1 = document.form1.Rewards.value};

    document. Form1.rewards.value = eval (Rew1);

    If (document.form1.Environment.value > "")

    {Env1 = document.form1.Environment.value};

    document. Form1.environment.value = eval (Env1);

    If (document.form1.Groups.value > "")

    {Gro1 = document.form1.Groups.value};

    document. Form1.groups.value = eval (Gro1);

    Totamt =

    eval (Opp1) +.

    eval (Inv1) +.

    eval (COM1) +.

    eval (wlb1) +.

    eval (COM2).

    eval (Atm1) +.

    eval (Per1) +.

    eval (Inc1) +.

    eval (Rew1) +.

    eval (Env1) +.

    eval (Gro1);

    document. Form1.GrandTotal.value = dm (eval (Totamt));

    }

    ->

    < /script >

    Any suggestions gratefully received.

    Sorry for the explanation of the solution, this is why you shouldn't let dyslexia on the forums...

    Yes, you can put onChange = "calculate ()" within any html element, but it will only work for items that have a 'value' that can change, such as "

    The average value can be reported by adding any of the following lines:

    Happy scripting!

  • Need help in the RTF form field to display the value yes or no based on xml

    Hello

    I have the data in xml format as follows: < CP_ZERO_COST > 2 < / CP_ZERO_COST >

    Now my requirement is, if CP_ZERO_COST is 2, then the column should display 'No' and CP_ZERO_COST is 1 column displays 'yes '. Now this 'yes' or 'no' is not in the xml tag. I need to do in the RTF form field.

    Could someone tell me please how to do this?

    Help, please.

    Thank you

    Try this:






    -You don't have to include this if the only possible values are 1 and 2.

    You can also use if so another logic. Be sure to specify the correct path to join CP_ZERO_COST

    Thank you!

  • Form based on a Table, only updated authorized, form does not display the data

    Hello

    I created a form based on a Table by the corresponding wizzard. The table has only one line. The shape didn't create or delete buttons, only update & Cancel is allowed. The PK (id field) is hidden and it takes the value of a database trigger when insert (in fact never is apllied because there is no Create).

    When the form is called it is already displayed in update mode, with cancel button allowed but not data in the fields. Line seems ok, session data available null to variables/positions. No idea why this is happenning? I expect to HAV the data in the form fields.

    TIA

    Hello

    Your primary key item have no value, I guess.
    Create calculations to set the value of the item that is in this single line in your table

    BR, Jari

  • Fields in the form are not displayed in OS 6.0

    I have app developed for BlackBerry that support the OS 4.3 and above.  It works very well on all OS up to 5.0 but here is the troublemaker.

    On devices which was 6.0, it truncates some fields like the bottom of the screen because the screen is fill with content.

    Yes, there is a limit of screen on OS 6 buffer?  or how is it these fields background getting disappeared?

    Any ideas would be greatly appreciated.

    Thank you

    Vincent

    Scrape some managers of custom layout you have. You specify the field that he has less the entire screen? Do it on the field!

    DateField todayDate = new DateField(...) {
      protected void layout(int width, int height) {
        super.layout(Math.min(width, myDesiredWidth), height);
      }
    };
    

    myDesiredWidth above can only be something calculated according to the police, or, say, the width of the screen - your choice. For now, the value as Display.getWidth () / 2 and see if you like the results.

    This code uses the fact that all predefined fields respect the width, height limits in their method of layout . I wish I could say the same thing about the custom/managers fields flying around in this forum and on the ' Net...

  • Uploaded photo is not displayed (was: Dreamweaver software problem)

    Hello I already checked with my server to make sure it wasn't a server problem for why my new photo when I download on my site does not appear so I was wondering if you could tell me how long do you think it will take for dreamweave solve this technical problem? I have known a similar problem one of my hyperlink work is not due to a server problem or dreamweaver?

    Hello thanks but now fixed to whatever the problem was with me doing nothing as well question do all those who support this great dreamweaver become you paid for it?

  • Conditional fields not displaying no not after closing and re-opening of form

    Hello

    I'm working on a purchase order that has some conditional fields / pages that need to be visible / hidden based on the user's selection. However when I close it, then reopen the form all parts are passed to default view (visible or hidden). How can I prevent that (other than to print the form in PDF format).

    Hello

    Under form properties... (Tab) default values, you can assign 'keep changes to scripts to form when registering' automatic.  If it is set to manual and you want to keep it this way you add the code in the initialize event to restore the State of form.

    Hope that helps

    Bruce

  • Townsend php file is not displayed using mamp

    Hello

    I do not know exactly whether to post this question in general dw forum or the php forum, so please bear with me.

    Thanks in advance for your help.

    I use dw cs3 and am doing the tutorial of David Powers on the establishment of a site for PHP MAMP by using the details of Café Townsend and the comments.php file.

    My MAMP is implemented with Apache port 8888 and 8889 port SQL.

    (It worked very well as a localhost for sites created with xhtml and xsl, so I think that the problem may be with the SQL)

    The fact that the timetest.php is displayed correctly in Safari and Firefox supports this view.

    In Firefox and Safari, the following addess is displayed:

    http://localhost:8888/php_test/comments.php

    But the page remains empty.

    In Live Data I told me that the problem is:

    1 - test server is not running the php files, or

    2 - or the folder is not mapped on the server test (does timetest works suggest to do this)

    DW tells me that the connection has been established successfully on:

    localhost:8889

    Columns of the sql database fields, appear in the window (required etc. as a parameter behind text) databases.

    I am doing something wrong, or if the comments.php file could be corrupted?

    Help, please.

    TX.

    Kind regards

    Gordon Eddey

    Good luck Gordon!

    My daughter just returned from a 6 weeks (for us) summer internship at SANCCOB in Cape Town.  She loved it.

  • Help! Weird question CF 9.02 when "in many" form fields are displayed in the 'post' method

    So we just installed cf9.02 64-bit on windows 2003 server machines brand new and migrated all code on and we have encountered in the wierdest (and very dead on the water) deliver, any display of a templae to FC with a "large" amount of fields using the method = "post" vomits, works well with the method = 'get' or with a small amount of fields.  Here are some examples of 'base' I pulled out of our application:

    https://dev1.mystudentsprogress.com/testposting/smallform.html -> it is method = 'post' and works well with a small number of fields, click on save and he called a CF model that simply says "index.cfm here."

    https://dev1.mystudentsprogress.com/testposting/formget.html -> it is method = 'get' and also works very well, click on save and then he calls a CF model that simply says "index.cfm here."

    https://dev1.mystudentsprogress.com/testposting/FormPost.html -> This is the method = 'post' and it barfs, click on save and you get a 500 error page

    And once this is the case that the 'next' call to even pages succesfull returns a blank page or go here:

    https://dev1.mystudentsprogress.com/testposting/smallform.html and click on save

    Go here again, and then click Save:

    https://dev1.mystudentsprogress.com/testposting/smallform.html


    .. There is nothing in any of the newspapers CF indicating any kind of errors, it's just flat barfs on forms with the post method and a large amount of fields, clearly a MAJOR issue because our app has a lot ot screens with a lot of fields!

    You could investigate the postParametersLimit and postSizeLimit values in file neo - runtime.xml of your server.  I suspect you'll need to increase the values of these two parameters.  Remember to save this file before making any changes. You will need to restart the CF server to apply the changes to the settings in this file.

    See FC 9.0.2 release notes for more information: http://helpx.adobe.com/coldfusion/release-note/coldfusion-9-0-update-2.html

Maybe you are looking for

  • HP Photosmart 7520e: HP 7520-e not scanning to E-mail more

    I had my Photosmart 7520e for over a year and have been able to perform all the activities about it without problem. However, the other day I found that I could scan is no longer e-mail. I tried to unplug the router and the printer and reconnect, as

  • Re: Equium M50-216 - lines across the screen

    Hi my Equium M50-216 has lines across the screen and low who go up and down the screen.There is no picture it s just white. If I plug it into an external monitor I get a fine display on the monitor is so the screen is defective or something else?I th

  • MacBook Air 11 '' Early 2015: normal sleep/standby consumption?

    Hello I can't help thinking that the power consumption of my MacBook Air 11 '' (early 2015) while "asleep" has increased lately - battery loses about 20% in 24 hours of sleep. " So, here's my question: is a loss of battery charge about 1% by standard

  • How output waveform desired by USB 6251?

    Hi all 1 I have problem like this: now, I use Laview 7.1, NI USB-6251, I want to output with desired waveform (shown on the attached picture). I want to know: 6251 USB can perform this problem. If Yes, can you advice me to solve it, I'm most recent w

  • HP officejet 4630 will not print on both sides of the paper

    Unable to print on both sides of the paper. The backsideprints first, then wait for the ink to dry, front end starts to print then stops with a windows error message popping up on the screen saying cannot print the document. I found that I can't prin