-
Posts
862 -
Joined
-
Last visited
-
Days Won
1
Posts posted by phppup
-
-
I'm trying to understand the mechanics of PHP.
Suppose I have a form that collects these three values
$firstname = $_POST['firstname'];
$middleinitial= $_POST['middleinitial'];
$lastname= $_POST['lastname'];
and I want to insert EVERYTHING into ONE FIELD in my table called FULL_NAME.
What is the methodI should use to COMBINE the values shown above?
Do they need to be listed individually in the statement below?
What if I want a final entry to contain fiirstname (space) middleinitial (period) (space) lastname all in one field?
$sql = "INSERT INTO myTable ( FULL_NAME ) VALUES ( $firstname,$middleinitial,$lastname )";
$result=mysql_query($sql);
Would the $SQL line look like this? Or am I totally off track?
-
I currently have a Javascript placed at the top of the same file as my HTML form.
Now I need to run the file as PHP, and was wondering what the proper protocol and best practice is for the JavaScript (which does some client side validation).
Can I leave it as is, at the top of the file after changing the extention to PHP.
If I put it in a seperate file, should I call it as a JavaScript or as an INCLUDE file.
If I INCLUDE it, should the INCLUDE be a PHP file (that contains the JS, or a JS extention.
Does any of this make a difference, or will any method work, leaving it to personal preference?
-
OKAY... so i was 'playing' the other evening, and i DID add a 'CLASS' to one button. After doing this, it accepted the size changes PERFECTLY.
I have to assume the group would react similarly.
So why will they respond in the CLASS (and in the tagline) but NOT when cirected by TYPE? Why does THAT work on the webpage (see above for the link) but NOT in my own browsers (which I attempted on two versions of IE running two different operating systems??
Any answers?
(could it be because I'm on the east coast?? LOL)
-
Hey Drummin. Nope, it won't work.
I've concluded that the server will NOT run PHP in an HTML file.
(i believe this is one of the reasons I got roped into learning full blown PHP in the first place... LOL)
It appears INCLUDES are also suspect. Although I've seen some articles that blame IntExplorer too.
I suppose I'll survive with just PHP files (but I'd have liked to see them as HTML at home, where my PC isn't running PHP.)
-
YES. I'm going to use DECIMAL with 4,1.
But in testing, I used INT and input the decimalled values and it worked.
The only "issue" I had was that they had no zeros for the whole numbers.
This was unlike the values that I had in the VARCHAR fields which DID add the zeros, but require too much disk space.
I suppose that this trail of making ALL the right moves for ALL the wrong reasons has ultimately lead me to the CORRECT answer (for whatever reasons).
Thanks for all the help.
-
OK, so I tried to get the html to INCLUDE on my server, and it didn't work either.
Now what?
-
I AM.
At least now I know where the coding example came from.... LOL
BUT, how come (even after i cut and pasted it) the button SIZE in MY BROWSER is REFUSING to change.
There's a glitch somewhere! Any clues??
-
Sorry to disappoint you, but this time, that IS the ENTIRE page with the ENTIRE code content.
All on page (for now).
With three lines of CSS.
Shouldn't it work the same as on a page with miles of code??
Of course it should. But it doesn't! WHY?
-
Not sure.
SO you're saying this ONLY works on the server that I maintain the website on?
And the machine in my bedroom probably won't recognize it?
-
There are 4,532 buttons. It will take me longer to ADD the CLASS or edit them INLINE than to simple control them by TYPE..... don't ya think???
I thought CSS could do this.... am I wrong?
-
It does NOT work!!
I just cut and pasted it AGAIN.
Change the size in CSS, and nothing happens!
-
I am recording orders for the sale of items.
People can order cases by the WHOLE or HALF quntity.
Thus, 1.0, 1.5,2.0, 2.5 etc.
I didn't initially realize that DECIMAL and FLOAT were COLUMN TYPES in their own right, I mistakenly thought they were OPTIONS for the INT values.
So, at this point, I suppose I can use EITHER the DECIMAL (or FLOAT for this instance, although still shakey as I've heard accuracy is an issue) or TINYINT with number_formatting to get the result I want and still be following the proper protocols.
-
How do I edit the code that "rythemton" mentioned if I'm not writing an array.
All the data is coming from a form.
I seem to get into trouble whenever there are ARRAYS that are ITEMIZED in the code rather than having values coming from a form or a table.
-
I have the code so that onClick of a submit button, a new window opens with information.
Now I want to move to a new window in the SAME browser, what is the code for that, so that it functions as if an <a href> tag were clicked?
-
I am having trouble using INCLUDE in my HTML. I know I've used it before, so I don't understand where my problem is coming from.
I created a simple HTML file named ok.htm, it has ONE line that says HI.
For testing, I actually added a second line for it to INCLUDE ITSELF:
<!--#include virtual="ok.htm" -->
It didn't work in itself, or any other HTML pages.
What am I doing wrong on my local machine?
-
I have a table with a 3 buttons and want to control the button size uniformly thru CSS.
My code below isn't working. Where have I gone wrong?
<html>
<head>
<style type="text/css">
input[type=button]
{
width: 20em;
}
</style>
</head>
<table>
<input type='button'>
-
Thank you DAVID!
Over-simplification EXPLAINS things perfectly; especially to those of us who might not truly realize WHAT were ASKING or WHY others think it's a problem.
Now I not only got my answer, but ALSO understand the importance of the sections.
PS: can you elaborate on the ISSET. I know it's the brief version of an IF, but it's caused me problems in the past. I have SANITATIoN and VALIDATION on my input fields, and the rest are dropdown menus.
Is there a way to put the "mysql_real_escape_string" is a loop to cover all the variables, or do they need to be sanitized individually?
-
This has to have been one of the MOST educating of 'simple questions' that I've ever asked in the forum. Good exchanges and loads of good info.
I personally use HTML strict figuring I'd like to KNOW it's correct than go with the browsers assumptions.
I'll leave this one open til tomorrow, in case anybody else wants to chime in.
(not sure, can it still be posted into after it's marked solved?)
-
I think i got way more than i bargained for with this one! LOL
I'd better MARK it SOLVED before the gloves come out!
-
Psycho... thanks for all the help!
In reality, I will probably ONLY occasionally require ONE decimal place. And realistically, it will present itself when the INPUT contains the halved-value.
In those instances where the .5 is present, it sort of takes care of itself.
So is the number_format still recommended? If so, why?
(i AM learning!!)
-
Let me try to make this a little more clear:
My code looks something like this:
//section ONE
apples = $POST ['apples']
donuts =$POST['donuts']
SQL= blah blah blah
//section TWO
INSERT (apples, donuts) VALUES ($apples, $donuts) etc
Is "section ONE" necessary to have in my script, or is redundant since the values are indicated in my results statement?
Some have said it's UNNECESSARY because the same info is being stated in section TWO, and others have indicated that it is "proper protocol" to aid in the scripts processing.
-
The field will ONLY be holding numeric values that are either whole values (with trailing zeros desired) 1.00, 2.00, 3.00, etc
Or havles: 1.50, 2.50, 3.50 etc.
But when queries are used, I want the values to line up evenly (the zeros on the whole numbers resolve this)
1.00
1.50
2.00
2.50 etc.
for that, I just NEED THE CODE format that goes into the CREATE TABLE function.
If there are alternative solutions, I will have to c onsider them.
Is there a way to edit the results of a statement that asks SQL= SELECT qty FROM mytable
so that the results are not
1
1.5
2
2.5 etc.?
Note: there are too many columns to use VARCHAR (which would provide the desired result)
-
Yes. I know this is NOT a Javascript forum (but I've been so engaged with learning PHP's abilities that I don't have time to join a JS group.. LOL)
I have a page with several "submit buttons" on it to handle several scripts. <input type="button" onClick=do this or do that value="WHATEVER i decided to write>
Because my buttons have different VALUES (submit, yabba dabba dooo, etc) the resulting buttons are different widths.
The problem: I want them all to be uniform.
I know I can style them INDIVIDUALLY to be the same size, but the real question is whether there's a single way to style them ALL through one script?
Can they be styled by TYPE (to say; make ALL "button" this size, or can this only be done by NAME)
It's probabaly already taken me longer to find the answer than if I'd just modify each button seperately, buy curiousity is obsessive. LOL
-
Can someone five me the correct code or format to use that will allow my TINYINT columns to carry TWO decimal places when creating my table? I have a script for creating the table and columns, but only recently learned that I need to ADD the TWO decimal place FUNCTION in order to get whole dollar values to display WITH the trailing zeros (ie.:2.00). I don't expect to need any values greater than xxx.xx in my columns, I'm just not clear on how to get the desired script when running the initial CREAT script.
Thanks
the mechanics of PHP
in PHP Coding Help
Posted
And what about the SQL statement?
How should that be modified?