Web Development Questions That Don't Need Their Own Thread v2
3,079 replies, posted
Using short tags is just a bad practice, you reduce the portability of your code. Is typing 3 more characters that hard?
Hi everyone, first time poster in the web dev section :)
So in IT recently we're making small websites, and instead of using Dreamweavers pre-set objects etc, I decided to try and learn HTML, and from there have learned about CSS just to try and make my HTML life easier
At one point in the site I'm going to make a form which brings you to another page after submitting and reads back your details, which I assumed you would need PHP to do, so I went to W3Schools and found this page, exactly what I wanted: [url]http://www.w3schools.com/php/php_forms.asp[/url]
But for some reason, when I enter my information and click submit, the information doesn't transfer over to the next page. Here's my current code
Form Test 1.html
[html]<!DOCTYPE html>
<html>
<head>
<title>Form Test (HTML)</title>
</head>
<body>
<form action="Form Test 2.php" method="post">
Name: <input type="text" name="fname" /><br />
Age: <input type="text" name="age" /><br />
<input type="submit" />
</form>
</body>
</html>[/html]
Form Test 2.php
[php]<!DOCTYPE html>
<html>
<head>
<title>Form Test (PHP)</title>
</head>
<body>
<p>Welcome <?php echo $_POST["fname"]; ?>!<br />
You are <?php echo $_POST["age"]; ?> years old.</p>
</body>
</html>[/php]
Now obviously I'm still a newbie to both languages, but seeing as they're from the W3 website I must have broken them somehow (And yes my scripts are in the same directory: Libraries/Custom/HTML/IT Coursework/
[QUOTE=xomaxhox;32291992]Hi everyone, first time poster in the web dev section :)
So in IT recently we're making small websites, and instead of using Dreamweavers pre-set objects etc, I decided to try and learn HTML, and from there have learned about CSS just to try and make my HTML life easier
At one point in the site I'm going to make a form which brings you to another page after submitting and reads back your details, which I assumed you would need PHP to do, so I went to W3Schools and found this page, exactly what I wanted: [url]http://www.w3schools.com/php/php_forms.asp[/url]
But for some reason, when I enter my information and click submit, the information doesn't transfer over to the next page. Here's my current code
Form Test 1.html
[html]<!DOCTYPE html>
<html>
<head>
<title>Form Test (HTML)</title>
</head>
<body>
<form action="Form Test 2.php" method="post">
Name: <input type="text" name="fname" /><br />
Age: <input type="text" name="age" /><br />
<input type="submit" />
</form>
</body>
</html>[/html]
Form Test 2.php
[php]<!DOCTYPE html>
<html>
<head>
<title>Form Test (PHP)</title>
</head>
<body>
<p>Welcome <?php echo $_POST["fname"]; ?>!<br />
You are <?php echo $_POST["age"]; ?> years old.</p>
</body>
</html>[/php]
Now obviously I'm still a newbie to both languages, but seeing as they're from the W3 website I must have broken them somehow (And yes my scripts are in the same directory: Libraries/Custom/HTML/IT Coursework/[/QUOTE]
what does Test 2.php show
Do not use w3schools.com
[url]http://w3fools.com/[/url]
[QUOTE=Ac!dL3ak;32292020]what does Test 2.php show[/QUOTE]
[img]http://filesmelt.com/dl/Problem10.png[/img]
[QUOTE=xomaxhox;32292114][img]http://filesmelt.com/dl/Problem10.png[/img][/QUOTE]
remove "Form" from the action
that's all i can really tell you
[QUOTE=xomaxhox;32292114][img]http://filesmelt.com/dl/Problem10.png[/img][/QUOTE]
First of all, you should never place spaces for page names. use - or _
2nd, they should work fine :v:
[QUOTE=Ac!dL3ak;32292240]remove "Form" from the action
that's all i can really tell you[/QUOTE]
No, that didn't work :L
But I just had a thought, do I have to download PHP from [url]http://www.php.net/downloads.php[/url] by any chance...
[QUOTE=zzlawlzz;32292569]First of all, you should never place spaces for page names. use - or _
2nd, they should work fine :v:[/QUOTE]
I changed the page name to test_1 and test_2, and obviously changed the links accordingly, but to no avail
[QUOTE=xomaxhox;32292704]No, that didn't work :L
But I just had a thought, do I have to download PHP from [url]http://www.php.net/downloads.php[/url] by any chance...
I changed the page name to test_1 and test_2, and obviously changed the links accordingly, but to no avail[/QUOTE]You have to have a working server in order to use PHP.
[QUOTE=Octave;32292748]You have to have a working server in order to use PHP.[/QUOTE]
Am I not able to create and run PHP code from my desktop cmoputer then, because that's all I have to do it with
[QUOTE=xomaxhox;32292773]Am I not able to create and run PHP code from my desktop cmoputer then, because that's all I have to do it with[/QUOTE]Nope, you would need to set up WAMP or something
[QUOTE=Octave;32292815]Nope, you would need to set up WAMP or something[/QUOTE]
Oh great, I hope to gawd that my school computers have php enabled or my ewbsite idea is screwed :L
Are there any free web hosting sites with other free domains I can use to host my site for free does anyone know please?
[QUOTE=xomaxhox;32292942]Oh great, I hope to gawd that my school computers have php enabled or my ewbsite idea is screwed :L
Are there any free web hosting sites with other free domains I can use to host my site for free does anyone know please?[/QUOTE]
x10 does free hosting
Why do you need to use PHP at school if you aren't being taught it?
[QUOTE=Ac!dL3ak;32292998]x10 does free hosting[/QUOTE]
Thanks a lot, I'm now queued and waiting for my free hosting :D
[QUOTE=Jelly;32293064]Why do you need to use PHP at school if you aren't being taught it?[/QUOTE]
Because I want to make a website a level above everyone elses and get a decent grade for it, we don't get taught how to use Photoshop but are expected to use it anyway
[editline]14th September 2011[/editline]
Hooray, after uploading to a site with PHP installed the PHP code works, who woulda though 'eh?
Thanks for all your help everyone, it's been a pleasant visit in the Web Dev section, maybe I'll be back again sometime :)
[QUOTE=sentrix;32289629]Using short tags is just a bad practice, you reduce the portability of your code. Is typing 3 more characters that hard?[/QUOTE]
Sorry but I greatly prefer <?=$var?> over <?php echo $fgt; ?>.
[QUOTE=hacksore;32295083]Sorry but I greatly prefer <?=$var?> over <?php echo $fgt; ?>.[/QUOTE]
Short echo tags (<?= ?>) will be enabled by default, independently of the short_open_tags configuration, starting with PHP 5.4
[QUOTE=StinkyJoe;32295205]Short echo tags (<?= ?>) will be enabled by default, independently of the short_open_tags configuration, starting with PHP 5.4[/QUOTE]
Doesn't that seem inconsistent, oh wait I'm talking about php :v:.
I'm working with Node.js and I've hit a problem I can't solve.
If I have code: [code]var x = {
'some-shit': 'more-shit'
};[/code]
Then how do I return the value of 'some-shit'? I can't just use the dot operator.
[QUOTE=sim642;32302086]I'm working with Node.js and I've hit a problem I can't solve.
If I have code: [code]var x = {
'some-shit': 'more-shit'
};[/code]
Then how do I return the value of 'some-shit'? I can't just use the dot operator.[/QUOTE]
Use square brackets:
[code]x['some-shit'][/code]
Alternatively, if you respect the naming rules (assuming you have control over the data, that is), as such:
[code]var x = {
some_shit : 'more-shit'
};
[/code]
You can use the dot operator.
[QUOTE=StinkyJoe;32302190]Use square brackets:
[code]x['some-shit'][/code]
Alternatively, if you respect the naming rules (assuming you have control over the data, that is), as such:
[code]var x = {
some_shit : 'more-shit'
};
[/code]
You can use the dot operator.[/QUOTE]
Thanks a lot! I had no idea about using square brackets over there.
I don't have control over the data since I'm trying to access http headers returned by a request.
Is it possible to retrive and store data in one SQL query? Or do I have to run two separate ones?
[QUOTE=pdkm931;32303323]Is it possible to retrive and store data in one SQL query? Or do I have to run two separate ones?[/QUOTE]
Couldn't you just string it along?
[code]SELECT * FROM `ABC`; INSERT INTO ...[/code]
[QUOTE=cas97;32309509]Couldn't you just string it along?
[code]SELECT * FROM `ABC`; INSERT INTO ...[/code][/QUOTE]
iirc mysql_* functions and mysqli won't let you do that
[QUOTE=sentrix;32309550]iirc mysql_* functions and mysqli won't let you do that[/QUOTE]
I would never dishonor myself or StinkyJoe by using mysql_*. Although mysqli I have no idea about :(
[editline]16th September 2011[/editline]
Also, PDO all the way. I have even forgotten how mysql_* works :v:
How do I make a nice noisy header bar thing? When I did it you guys said it looked like JPEG rape :saddowns:
EDIT:
I use GIMP.
[QUOTE=toaster468;32310219]How do I make a nice noisy header bar thing? When I did it you guys said it looked like JPEG rape :saddowns:
EDIT:
I use GIMP.[/QUOTE]
PNG?
[QUOTE=toaster468;32310219]How do I make a nice noisy header bar thing? When I did it you guys said it looked like JPEG rape :saddowns:
EDIT:
I use GIMP.[/QUOTE]In the menu, go Filter > Noise > HSV Noise. The default settings work pretty well, and you can tweak lots of them to get whatever you want.
Couldn't find this anywhere, and I'm pretty sure all the "Top hosting sites" sites are just a "pay me and I'll put you on the top" type of deal, so..
What're the best hosting and domain name registration options around?
gandi.net is an awesome place to register domains, they have great service too
I have all of mine there, but whatever you do, DON'T EVER USE GODADDY, it is terrible
Sorry, you need to Log In to post a reply to this thread.