Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #16049
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | "J.O. Aho" <user@example.net> |
| Newsgroups | comp.lang.php |
| Subject | Re: test prog inpu tpost |
| Date | Fri, 1 Jan 2016 09:40:44 +0100 |
| Lines | 80 |
| Message-ID | <demsccFq5f4U1@mid.individual.net> (permalink) |
| References | <n64mdp$ppg$1@reader1.panix.com> <kplhy.63798$MN2.2950@fx07.iad> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net 1Gtbj4HkpDYd5s0CylHWTg+sggxbieeNNzo8WaTtjXDXWF3+0l |
| Cancel-Lock | sha1:FC3CCf6efeeU0XLmvRTiROpXvB0= |
| X-Enigmail-Draft-Status | N1110 |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
| In-Reply-To | <kplhy.63798$MN2.2950@fx07.iad> |
| Xref | csiph.com comp.lang.php:16049 |
Show key headers only | View raw
On 01/01/2016 03:22 AM, Lew Pitcher wrote:
> On Thursday December 31 2015 20:57, in
> comp.lang.php, "vjp2.at@at.BioStrategist.dot.dot.com"
> <vjp2.at@at.BioStrategist.dot.dot.com> wrote:
>
>>
>> Should this work?
>
>> I'm stuck with lynx browser for a few days and can't tell
>
> That shouldn't stop you, assuming that you have a PHP-enabled webserver to
> host the page on.
>
> Lynx, like all browsers, just renders the html sent to it by the server.
>
> PHP code executes on the server.
>
> If the html with PHP is served from a PHP-enabled web server, lynx will render
> the results correctly.
>
>> <html>
>> <head>
>> <title>Quadratic</title>
>> </head>
>> <body>
>> <?php
>> $t;
>
> What is $t ?
> Why are you trying to execute it as a php statement?
I think the OP is trying to initiate the variable before use, so to not
get errors with uninitiated variables, but will instead generate the
error as they are uninitiated.
>> $b=$_POST['b'];$a=$_POST['a'];$c=$_POST['c'];
>
> Here, you should test whether the page is invoked from a GET or a POST. None
> of the $_POST variables will be set on the initial GET, and your later
> computation will be invalid.
If allowing both, you could use $_REQUEST, but you should avoid to use
that, as it makes it easier to do unintended things.
Should always validate that you have got what you wanted in a request,
so should use for example is_numeric() to verify that the value is not
something else and stop the processing already here if it's invalid data.
>
>> if($t<=0)
>> $t=(-1)*$t;
>> $x=(-2*$c)/($b+(sqrt($t)));
>> $y=(-2*$c)/($b-(sqrt($t)));
>> echo sprintf("Solution in Addition = %f in Subtraction = %f" ,$x,$y);
>
> This last stmt is overly complicated. Why wouldn't you just
> printf("Solution in Addition = %f in Subtraction = %f" ,$x,$y);
> ?
PHP allows you to use a lot of different ways, for example
echo "Solution in Addition = {$x} in Subtraction = {$y}";
would work in this case too.
>> ?>
>> <form method="post">
>> <label>What is a? <input type="number" name="a"></label><br>
>> <label>What is b? <input type="number" name="b"></label><br>
>> <label>What is c? <input type="number" name="c"></label><br>
>
> I'm not entirely certain that this is the proper use for the <label> element.
No it's malformed, the label should have been closed before the input,
for those who want to know a little bit more of the use can head to
http://www.w3schools.com/tags/tag_label.asp
--
//Aho
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
test prog inpu tpost vjp2.at@at.BioStrategist.dot.dot.com - 2016-01-01 01:57 +0000
Re: test prog inpu tpost Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-12-31 21:22 -0500
Re: test prog inpu tpost Matthew Carter <m@ahungry.com> - 2015-12-31 21:40 -0500
Re: test prog inpu tpost "J.O. Aho" <user@example.net> - 2016-01-01 09:40 +0100
Re: test prog inpu tpost Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-01 09:32 -0500
Re: test prog inpu tpost Arno Welzel <usenet@arnowelzel.de> - 2016-01-01 18:24 +0100
Re: test prog inpu tpost Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-01 14:07 -0500
Re: test prog inpu tpost Matthew Carter <m@ahungry.com> - 2016-01-01 21:40 -0500
Re: test prog inpu tpost Jerry Stuckle <jstucklex@attglobal.net> - 2016-01-01 21:53 -0500
Re: test prog inpu tpost Arno Welzel <usenet@arnowelzel.de> - 2016-01-02 11:39 +0100
Re: test prog inpu tpost Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-02 22:43 +0100
Re: test prog inpu tpost Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-12-31 21:39 -0500
Re: test prog inpu tpost vjp2.at@at.BioStrategist.dot.dot.com - 2016-01-07 03:19 +0000
csiph-web