• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 10:56
CEST 16:56
KST 23:56
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
Serral wins HomeStory Cup 2914Serral wins Maestros of the Game 243ByuL, and the Limitations of Standard Play3Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12
Community News
IntoTheTV X SOOP SC2 League : Weekly & Monthly4Clem: "I don't have that much hope in Blizzard"2ZeroSpace Early Access is Now Live!24Weekly Cups (July 13-19): Terran & Protoss rise; Zerg falters2Balance hotfix patch 5.0.16b (July 16)90
StarCraft 2
General
Reynor: GSL Loss Wasn't About Preparation Format Balance hotfix patch 5.0.16b (July 16) How would you feel about frequent/monthly balance patches for SC2? Clem: "I don't have that much hope in Blizzard" Weekly Cups (July 13-19): Terran & Protoss rise; Zerg falters
Tourneys
IntoTheTV X SOOP SC2 League : Weekly & Monthly INu's Battles#18 - Cure, herO, Rogue & ByuN RSL Revival: Season 6 - Qualifiers and Main Event Master Swan Open (Global Bronze-Master 2) WardiTV Summer Cup 2026
Strategy
[G] Having the right mentality to improve
Custom Maps
[M] (2) Industrial Park New Map Maker - Looking for Advice - Love or Hate
External Content
Mutation # 535 Assembly of Vengeance The PondCast: SC2 News & Results Mutation # 534 Burning Evacuation Mutation # 533 Die Together
Brood War
General
ASL22 General Discussion BW General Discussion How Famous was FlaSh before his Debut? Animated Gateway BGH Auto Balance -> http://bghmmr.eu/
Tourneys
Escore Tournament - Season 3 Small VOD Thread 2.0 [Megathread] Daily Proleagues [IPSL] Spring 2026 Grand Finals - This Weekend!
Strategy
Simple Questions, Simple Answers PvT advise for noobs Fighting Spirit mining rates Creating a full chart of Zerg builds
Other Games
General Games
Path of Exile ZeroSpace Early Access is Now Live! General RTS Discussion Thread Nintendo Switch Thread Diablo IV
Dota 2
Looking for a Dota Mentor Official 'what is Dota anymore' discussion
League of Legends
TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread TL Mafia Power Rank NeO.D_StephenKing vs This Guy From 1 Million Dance Vanilla Mini Mafia
Community
General
Artificial Intelligence Thread US Politics Mega-thread Russo-Ukrainian War Thread How to buy a book - shipping from Korea to Europe The Games Industry And ATVI
Fan Clubs
The IdrA Fan Club The HerO Fan Club!
Media & Entertainment
Anime Discussion Thread Series you have seen recently... Movie Discussion! [Req][Books] Good Fantasy/SciFi books
Sports
TeamLiquid Health and Fitness Initiative For 2023 2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023 McBoner: A hockey love story
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Simple Questions Simple Answers FPS when play League Of Legend on laptop
TL Community
Northern Ireland Global Starcraft The Automated Ban List
Blogs
How Games can Help with Majo…
TrAiDoS
Hello guys!
LIN1s
ASL S22 English Commentary…
namkraft
Poker (part 2)
Nebuchad
An Exploration of th…
waywardstrategy
Customize Sidebar...

Website Feedback

Closed Threads



Active: 3340 users

The Big Programming Thread - Page 500

Forum Index > General Forum
Post a Reply
Prev 1 498 499 500 501 502 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
phar
Profile Joined August 2011
United States1080 Posts
July 15 2014 03:48 GMT
#9981
On July 14 2014 16:14 artynko wrote:
Show nested quote +
On July 14 2014 09:36 WoolySheep wrote:
Just wondering if anyone else has experienced self-righteous, elitist coders at places they work? A lot of people I have worked with would always say "this code sucks", I should rewrite the whole thing", "The person who coded this was dumb", and it really ticks me off. Probably at the time of coding the idea was to do it a certain way but it has since changed. They tend to use fancy language and over-complicate issues in the attempt to sound smart.

Anyone else experience this?

Happens, all the time, and then when you check the commit history it was either the person complaining or you who did the stupid change. Everytime you have a look at a code that was written a year ago it will look like a retarded monkey wrote it.

^^^ Yeaaaa pretty much.
Who after all is today speaking about the destruction of the Armenians?
sob3k
Profile Blog Joined August 2009
United States7572 Posts
Last Edited: 2014-07-16 00:52:04
July 15 2014 20:46 GMT
#9982
I' trying to make a MEGA basic contact form that mails an address with the info from a form. I've been using PHP.

Here is the form. Is this ok? Anything I need or don't need here?

<form action="jmailscript.php" method="post">
Name:<br /> <input type="text" placeholder="Name" name="name"><br>
Email:<br /> <input type="text" placeholder="Email" name="email"><br>
Phone:<br /> <input type="text" placeholder="Phone" name="phone"><br>
Property Address:<br /> <input type="text" placeholder="Property Address" name="address"><br>
Property City:<br /> <input type="text" placeholder="Property City" name="city"><br>
Property State:<br /> <input type="text" placeholder="Property State" name="state"><br>
Property Zip:<br /> <input type="text" placeholder="Property Zip" name="zip"><br><br>

<button type="submit" name="submit" value="Submit" class="button" data-type="text" id="submit-btn">Submit</button>
</form>


How would I make a super unsafe simple PHP script to mail an address this info when submit is pressed? I've tried several copy pastes with various levels of complexity and I can't get it to work. I understand very basic PHP syntax and the functions used but I'm clearly not understanding the scripts fully. Also I just learned that apparently you just cannot test mail() on a local server such as Xampp (this could explain some of my failures)? If I just upload it to my domain will that work?

I just want someone to ask a few pointed questions about what certain things are doing.

EDIT: OMFG I did it. very simple when I figured it out

this is my script:

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$from = 'From: My Site';
$to = 'myemail@gmail.com';
$subject = 'Property Information';

$body = "From: $name\n E-Mail: $email\n Phone: $phone\n Address: $address\n City: $city\n State: $state\n ZIP: $zip";

if ($_POST['submit']) {
mail($to, $subject, $body, $from);
echo "Submission Accepted!";
}

?>


Follow up, how would I adjust things to include the script on the form page you it doesn't take you away from the form?
In Hungry Hungry Hippos there are no such constraints—one can constantly attempt to collect marbles with one’s hippo, limited only by one’s hippo-levering capabilities.
berated-
Profile Blog Joined February 2007
United States1134 Posts
Last Edited: 2014-07-16 01:56:24
July 16 2014 01:56 GMT
#9983
On July 16 2014 05:46 sob3k wrote:
I' trying to make a MEGA basic contact form that mails an address with the info from a form. I've been using PHP.

... stuff ...

Follow up, how would I adjust things to include the script on the form page you it doesn't take you away from the form?


I'm making the assumption that when you mean "doesn't take you away from the form", you mean you really don't want to leave the page, not that its acceptable to do a form submit and then come back to the form.

--

PHP doesn't normally run in the browser, it runs on the server. When you submit the form, it is sent to your server and evetnually the php file. The script handles the request, it then builds some HTML (or text in this case) and sends the response to the browser. At this point, the server is no longer involved - all of the response is rendered by the browser.

What you are looking for is making asynchronous requests to the server from the browser, most commonly referred to as AJAX. In this way of working, one would request the HTML, see the form, then using the XHR object (or library wrapping XHR) would send the email request to the server, never actually doing the form submit from the page.

If you google ajax form submit, it will start to show you some options.
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
July 16 2014 02:37 GMT
#9984
Any specific reasons why you're pushing it to the server and not just using Javascript?

Not being facetious with the question. There are a lot of good reasons for having only a form on the client side, and the actual email sending being server side (obscuring email addresses being a major one).
Average means I'm better than half of you.
CatNzHat
Profile Blog Joined February 2011
United States1599 Posts
Last Edited: 2014-07-16 07:19:15
July 16 2014 07:18 GMT
#9985
On July 16 2014 11:37 WolfintheSheep wrote:
Any specific reasons why you're pushing it to the server and not just using Javascript?

Not being facetious with the question. There are a lot of good reasons for having only a form on the client side, and the actual email sending being server side (obscuring email addresses being a major one).

You can't send mail through javascript, it doesn't allow you to make an outgoing connection to a random ip and port using SMTP protocol. This is why the server is required.
WolfintheSheep
Profile Joined June 2011
Canada14127 Posts
July 16 2014 18:46 GMT
#9986
On July 16 2014 16:18 CatNzHat wrote:
Show nested quote +
On July 16 2014 11:37 WolfintheSheep wrote:
Any specific reasons why you're pushing it to the server and not just using Javascript?

Not being facetious with the question. There are a lot of good reasons for having only a form on the client side, and the actual email sending being server side (obscuring email addresses being a major one).

You can't send mail through javascript, it doesn't allow you to make an outgoing connection to a random ip and port using SMTP protocol. This is why the server is required.


Ah, misread, thought he was just doing something like a mailto.
Average means I'm better than half of you.
KlaCkoN
Profile Blog Joined May 2007
Sweden1661 Posts
July 17 2014 05:35 GMT
#9987
Am I OK asking for help in this thread?
I am having a labview (real programmers, feel free to laugh) problem at work. I am using an Ni-6229 data acquisition card to generate output and read in the resulting response from some machine.

I need 4 things to happen, 3 of which work fine so far.
1, Generate an analogue output task with very high sampling rate.
2. A digital pulse train that matches the analogue output (this opens a "gate" in the circuit, letting nonzero output through.
3. Read in an analogue response with very precise timing relative to the output.
These three things all work fine.

4. I need a second output task (digital or analogue doesn't matter) that runs before the first output. The problem is that this task needs to run for a long time (~20 seconds, but timing is not very important) so I want the sampling rate to be much lower than for the first output task. However the card won't let me setup two output tasks with different sampling rates. Or I should say, I cant get the card to do it.
So far I have been using the first task to do this part however the long duration of this step limits the sampling rate available to me in the important output task - The computer just dies if I try to generate 20 seconds of samples at 20MHz...
I would very much like to be able to generate the samples for the two outputs at different rates using only the one DAQ card. Any tips would be greatly appreciated.
"Voice or no voice the people can always be brought to the bidding of their leaders ... All you have to do is tell them they are being attacked and denounce the pacifists for lack of patriotism and exposing the country to danger."
aksfjh
Profile Joined November 2010
United States4853 Posts
July 17 2014 15:06 GMT
#9988
On July 17 2014 14:35 KlaCkoN wrote:
Am I OK asking for help in this thread?
I am having a labview (real programmers, feel free to laugh) problem at work. I am using an Ni-6229 data acquisition card to generate output and read in the resulting response from some machine.

I need 4 things to happen, 3 of which work fine so far.
1, Generate an analogue output task with very high sampling rate.
2. A digital pulse train that matches the analogue output (this opens a "gate" in the circuit, letting nonzero output through.
3. Read in an analogue response with very precise timing relative to the output.
These three things all work fine.

4. I need a second output task (digital or analogue doesn't matter) that runs before the first output. The problem is that this task needs to run for a long time (~20 seconds, but timing is not very important) so I want the sampling rate to be much lower than for the first output task. However the card won't let me setup two output tasks with different sampling rates. Or I should say, I cant get the card to do it.
So far I have been using the first task to do this part however the long duration of this step limits the sampling rate available to me in the important output task - The computer just dies if I try to generate 20 seconds of samples at 20MHz...
I would very much like to be able to generate the samples for the two outputs at different rates using only the one DAQ card. Any tips would be greatly appreciated.

Some clarifying questions: Why does it (4) have to be a lower sampling rate? Do you have to store all the output values? Why do you need to send ~20 seconds of output, and is there any way to just sleep during that period or loop a smaller output for ~20 seconds?
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2014-07-17 17:12:07
July 17 2014 17:11 GMT
#9989
Just wondering, how many of you still play StarCraft and enjoy it? If you don't play it, then which game have you picked nowadays?
nunez
Profile Blog Joined February 2011
Norway4003 Posts
July 17 2014 17:22 GMT
#9990
i played starcraft 2 since release and is still my only game.
<3
conspired against by a confederacy of dunces.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
July 17 2014 17:36 GMT
#9991
On July 18 2014 02:11 darkness wrote:
Just wondering, how many of you still play StarCraft and enjoy it? If you don't play it, then which game have you picked nowadays?

Lost interest in SC2 at some point during the beta (and just as I predicted it, in BW as well). I'm playing various games now. Mahjong over a long period of time (but I'm mentally way too exhausted after work to play well), other than that mostly single-play-through puzzle and adventure games, old and new titles.
If you have a good reason to disagree with the above, please tell me. Thank you.
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
July 17 2014 18:24 GMT
#9992
On July 18 2014 02:11 darkness wrote:
Just wondering, how many of you still play StarCraft and enjoy it? If you don't play it, then which game have you picked nowadays?


I've been playing dota 2 since it came out instead of starcraft. I still occasionally play brood war.
Any sufficiently advanced technology is indistinguishable from magic
KlaCkoN
Profile Blog Joined May 2007
Sweden1661 Posts
July 17 2014 19:04 GMT
#9993
On July 18 2014 00:06 aksfjh wrote:
Show nested quote +
On July 17 2014 14:35 KlaCkoN wrote:
Am I OK asking for help in this thread?
I am having a labview (real programmers, feel free to laugh) problem at work. I am using an Ni-6229 data acquisition card to generate output and read in the resulting response from some machine.

I need 4 things to happen, 3 of which work fine so far.
1, Generate an analogue output task with very high sampling rate.
2. A digital pulse train that matches the analogue output (this opens a "gate" in the circuit, letting nonzero output through.
3. Read in an analogue response with very precise timing relative to the output.
These three things all work fine.

4. I need a second output task (digital or analogue doesn't matter) that runs before the first output. The problem is that this task needs to run for a long time (~20 seconds, but timing is not very important) so I want the sampling rate to be much lower than for the first output task. However the card won't let me setup two output tasks with different sampling rates. Or I should say, I cant get the card to do it.
So far I have been using the first task to do this part however the long duration of this step limits the sampling rate available to me in the important output task - The computer just dies if I try to generate 20 seconds of samples at 20MHz...
I would very much like to be able to generate the samples for the two outputs at different rates using only the one DAQ card. Any tips would be greatly appreciated.

Some clarifying questions: Why does it (4) have to be a lower sampling rate? Do you have to store all the output values? Why do you need to send ~20 seconds of output, and is there any way to just sleep during that period or loop a smaller output for ~20 seconds?

Thank you for taking an interest! I want (4) to have a lower sampling rate than (1) because as it stands (4) is limiting the sampling rate available to me in (1) because (4) runs for such a long time.
In order to make things more concrete: at the moment I am generating the output samples at 0.1MHz. This task (split over several channels on the card) takes care of both (1) and (4). However I need better resolution than that in (1). But if I simply increase the output task sampling rate to say 10MHz it will be forced to generate ~200E6 samples which causes either the card or the computer to be sad, in any case everything shuts down.
What I would want to do is generate (4) at a much lower sampling rate, say 100Hz, which would let me sample (1) as fast as the card can handle - But it doesn't seem to be possible to have two different output tasks running separate sampling rates open at the same time.
I don't need to store the output values, the computer generates the samples and then I write them to the hardware card before I tell everything to go. (This is necessary for timing purposes)
As for why (4) is necessary: It's a constant 3.7 volt signal that preps part of the machine for the real measurement. (It's pneumatically suspending the sample in a prep region)
I really like the loop idea but I can't make it happen for the same reason as I can't make two tasks with separate rates. In order to do it the channel that runs (4) would need to be separate from (1) and I can't seem to make two independent output tasks.

--- Actually hmm, upon more consideration I think I could make the loop thing work. It would just be hilariously ugly.
I could prepare my output task where (4) is the first part but only say 0.5 seconds long instead of 20 seconds. And (1) is the second part. (~100us). And then I just start and stop the task over and over again until the first part has run for a total of 20 sec xd. (Always stopping before it gets to (1). Then on the final iteration it just gets to finish.
But yes, hilariously ugly is an understatement xd.
"Voice or no voice the people can always be brought to the bidding of their leaders ... All you have to do is tell them they are being attacked and denounce the pacifists for lack of patriotism and exposing the country to danger."
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
July 17 2014 19:13 GMT
#9994
On July 18 2014 04:04 KlaCkoN wrote:
Show nested quote +
On July 18 2014 00:06 aksfjh wrote:
On July 17 2014 14:35 KlaCkoN wrote:
Am I OK asking for help in this thread?
I am having a labview (real programmers, feel free to laugh) problem at work. I am using an Ni-6229 data acquisition card to generate output and read in the resulting response from some machine.

I need 4 things to happen, 3 of which work fine so far.
1, Generate an analogue output task with very high sampling rate.
2. A digital pulse train that matches the analogue output (this opens a "gate" in the circuit, letting nonzero output through.
3. Read in an analogue response with very precise timing relative to the output.
These three things all work fine.

4. I need a second output task (digital or analogue doesn't matter) that runs before the first output. The problem is that this task needs to run for a long time (~20 seconds, but timing is not very important) so I want the sampling rate to be much lower than for the first output task. However the card won't let me setup two output tasks with different sampling rates. Or I should say, I cant get the card to do it.
So far I have been using the first task to do this part however the long duration of this step limits the sampling rate available to me in the important output task - The computer just dies if I try to generate 20 seconds of samples at 20MHz...
I would very much like to be able to generate the samples for the two outputs at different rates using only the one DAQ card. Any tips would be greatly appreciated.

Some clarifying questions: Why does it (4) have to be a lower sampling rate? Do you have to store all the output values? Why do you need to send ~20 seconds of output, and is there any way to just sleep during that period or loop a smaller output for ~20 seconds?

Thank you for taking an interest! I want (4) to have a lower sampling rate than (1) because as it stands (4) is limiting the sampling rate available to me in (1) because (4) runs for such a long time.
In order to make things more concrete: at the moment I am generating the output samples at 0.1MHz. This task (split over several channels on the card) takes care of both (1) and (4). However I need better resolution than that in (1). But if I simply increase the output task sampling rate to say 10MHz it will be forced to generate ~200E6 samples which causes either the card or the computer to be sad, in any case everything shuts down.
What I would want to do is generate (4) at a much lower sampling rate, say 100Hz, which would let me sample (1) as fast as the card can handle - But it doesn't seem to be possible to have two different output tasks running separate sampling rates open at the same time.
I don't need to store the output values, the computer generates the samples and then I write them to the hardware card before I tell everything to go. (This is necessary for timing purposes)
As for why (4) is necessary: It's a constant 3.7 volt signal that preps part of the machine for the real measurement. (It's pneumatically suspending the sample in a prep region)
I really like the loop idea but I can't make it happen for the same reason as I can't make two tasks with separate rates. In order to do it the channel that runs (4) would need to be separate from (1) and I can't seem to make two independent output tasks.

--- Actually hmm, upon more consideration I think I could make the loop thing work. It would just be hilariously ugly.
I could prepare my output task where (4) is the first part but only say 0.5 seconds long instead of 20 seconds. And (1) is the second part. (~100us). And then I just start and stop the task over and over again until the first part has run for a total of 20 sec xd. (Always stopping before it gets to (1). Then on the final iteration it just gets to finish.
But yes, hilariously ugly is an understatement xd.


You can upsample (4) to the same rate as (1), then down sample it later. It would be the "LabView way": http://zone.ni.com/reference/en-XX/help/371361H-01/lvanls/upsample/
Any sufficiently advanced technology is indistinguishable from magic
aksfjh
Profile Joined November 2010
United States4853 Posts
July 19 2014 13:14 GMT
#9995
On July 18 2014 04:13 RoyGBiv_13 wrote:
Show nested quote +
On July 18 2014 04:04 KlaCkoN wrote:
On July 18 2014 00:06 aksfjh wrote:
On July 17 2014 14:35 KlaCkoN wrote:
Am I OK asking for help in this thread?
I am having a labview (real programmers, feel free to laugh) problem at work. I am using an Ni-6229 data acquisition card to generate output and read in the resulting response from some machine.

I need 4 things to happen, 3 of which work fine so far.
1, Generate an analogue output task with very high sampling rate.
2. A digital pulse train that matches the analogue output (this opens a "gate" in the circuit, letting nonzero output through.
3. Read in an analogue response with very precise timing relative to the output.
These three things all work fine.

4. I need a second output task (digital or analogue doesn't matter) that runs before the first output. The problem is that this task needs to run for a long time (~20 seconds, but timing is not very important) so I want the sampling rate to be much lower than for the first output task. However the card won't let me setup two output tasks with different sampling rates. Or I should say, I cant get the card to do it.
So far I have been using the first task to do this part however the long duration of this step limits the sampling rate available to me in the important output task - The computer just dies if I try to generate 20 seconds of samples at 20MHz...
I would very much like to be able to generate the samples for the two outputs at different rates using only the one DAQ card. Any tips would be greatly appreciated.

Some clarifying questions: Why does it (4) have to be a lower sampling rate? Do you have to store all the output values? Why do you need to send ~20 seconds of output, and is there any way to just sleep during that period or loop a smaller output for ~20 seconds?

Thank you for taking an interest! I want (4) to have a lower sampling rate than (1) because as it stands (4) is limiting the sampling rate available to me in (1) because (4) runs for such a long time.
In order to make things more concrete: at the moment I am generating the output samples at 0.1MHz. This task (split over several channels on the card) takes care of both (1) and (4). However I need better resolution than that in (1). But if I simply increase the output task sampling rate to say 10MHz it will be forced to generate ~200E6 samples which causes either the card or the computer to be sad, in any case everything shuts down.
What I would want to do is generate (4) at a much lower sampling rate, say 100Hz, which would let me sample (1) as fast as the card can handle - But it doesn't seem to be possible to have two different output tasks running separate sampling rates open at the same time.
I don't need to store the output values, the computer generates the samples and then I write them to the hardware card before I tell everything to go. (This is necessary for timing purposes)
As for why (4) is necessary: It's a constant 3.7 volt signal that preps part of the machine for the real measurement. (It's pneumatically suspending the sample in a prep region)
I really like the loop idea but I can't make it happen for the same reason as I can't make two tasks with separate rates. In order to do it the channel that runs (4) would need to be separate from (1) and I can't seem to make two independent output tasks.

--- Actually hmm, upon more consideration I think I could make the loop thing work. It would just be hilariously ugly.
I could prepare my output task where (4) is the first part but only say 0.5 seconds long instead of 20 seconds. And (1) is the second part. (~100us). And then I just start and stop the task over and over again until the first part has run for a total of 20 sec xd. (Always stopping before it gets to (1). Then on the final iteration it just gets to finish.
But yes, hilariously ugly is an understatement xd.


You can upsample (4) to the same rate as (1), then down sample it later. It would be the "LabView way": http://zone.ni.com/reference/en-XX/help/371361H-01/lvanls/upsample/

Yea, that would probably work even better. Without the modules in front of me, I'm not sure what tools one has to work with in LabView.

Also, ugly working code is always better than pretty non-working code...
Manit0u
Profile Blog Joined August 2004
Poland17800 Posts
Last Edited: 2014-07-19 14:41:20
July 19 2014 14:39 GMT
#9996
On July 16 2014 05:46 sob3k wrote:
I' trying to make a MEGA basic contact form that mails an address with the info from a form. I've been using PHP.

Here is the form. Is this ok? Anything I need or don't need here?

<form action="jmailscript.php" method="post">
Name:<br /> <input type="text" placeholder="Name" name="name"><br>
Email:<br /> <input type="text" placeholder="Email" name="email"><br>
Phone:<br /> <input type="text" placeholder="Phone" name="phone"><br>
Property Address:<br /> <input type="text" placeholder="Property Address" name="address"><br>
Property City:<br /> <input type="text" placeholder="Property City" name="city"><br>
Property State:<br /> <input type="text" placeholder="Property State" name="state"><br>
Property Zip:<br /> <input type="text" placeholder="Property Zip" name="zip"><br><br>

<button type="submit" name="submit" value="Submit" class="button" data-type="text" id="submit-btn">Submit</button>
</form>


How would I make a super unsafe simple PHP script to mail an address this info when submit is pressed? I've tried several copy pastes with various levels of complexity and I can't get it to work. I understand very basic PHP syntax and the functions used but I'm clearly not understanding the scripts fully. Also I just learned that apparently you just cannot test mail() on a local server such as Xampp (this could explain some of my failures)? If I just upload it to my domain will that work?

I just want someone to ask a few pointed questions about what certain things are doing.

EDIT: OMFG I did it. very simple when I figured it out

this is my script:

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$from = 'From: My Site';
$to = 'myemail@gmail.com';
$subject = 'Property Information';

$body = "From: $name\n E-Mail: $email\n Phone: $phone\n Address: $address\n City: $city\n State: $state\n ZIP: $zip";

if ($_POST['submit']) {
mail($to, $subject, $body, $from);
echo "Submission Accepted!";
}

?>


Follow up, how would I adjust things to include the script on the form page you it doesn't take you away from the form?


Why are you doing this in pure PHP? If you want pretty bare-bones PHP then go with PHP MVC microframework. Select the advanced version which will give you access to awesome Twig templating engine and Sass for easier styling. And do your forms this way, much easier and you can simply put your script in the controller: http://symfony.com/doc/current/book/forms.html
Time is precious. Waste it wisely.
berated-
Profile Blog Joined February 2007
United States1134 Posts
July 19 2014 15:45 GMT
#9997
On July 19 2014 23:39 Manit0u wrote:
Show nested quote +
On July 16 2014 05:46 sob3k wrote:
I' trying to make a MEGA basic contact form that mails an address with the info from a form. I've been using PHP.

Here is the form. Is this ok? Anything I need or don't need here?

<form action="jmailscript.php" method="post">
Name:<br /> <input type="text" placeholder="Name" name="name"><br>
Email:<br /> <input type="text" placeholder="Email" name="email"><br>
Phone:<br /> <input type="text" placeholder="Phone" name="phone"><br>
Property Address:<br /> <input type="text" placeholder="Property Address" name="address"><br>
Property City:<br /> <input type="text" placeholder="Property City" name="city"><br>
Property State:<br /> <input type="text" placeholder="Property State" name="state"><br>
Property Zip:<br /> <input type="text" placeholder="Property Zip" name="zip"><br><br>

<button type="submit" name="submit" value="Submit" class="button" data-type="text" id="submit-btn">Submit</button>
</form>


How would I make a super unsafe simple PHP script to mail an address this info when submit is pressed? I've tried several copy pastes with various levels of complexity and I can't get it to work. I understand very basic PHP syntax and the functions used but I'm clearly not understanding the scripts fully. Also I just learned that apparently you just cannot test mail() on a local server such as Xampp (this could explain some of my failures)? If I just upload it to my domain will that work?

I just want someone to ask a few pointed questions about what certain things are doing.

EDIT: OMFG I did it. very simple when I figured it out

this is my script:

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$from = 'From: My Site';
$to = 'myemail@gmail.com';
$subject = 'Property Information';

$body = "From: $name\n E-Mail: $email\n Phone: $phone\n Address: $address\n City: $city\n State: $state\n ZIP: $zip";

if ($_POST['submit']) {
mail($to, $subject, $body, $from);
echo "Submission Accepted!";
}

?>


Follow up, how would I adjust things to include the script on the form page you it doesn't take you away from the form?


Why are you doing this in pure PHP? If you want pretty bare-bones PHP then go with PHP MVC microframework. Select the advanced version which will give you access to awesome Twig templating engine and Sass for easier styling. And do your forms this way, much easier and you can simply put your script in the controller: http://symfony.com/doc/current/book/forms.html


Generally we need to walk before we run. I'm thinking someone that just figured out a mailto might be a tad overwhelmed with phpmvc and sass.
Manit0u
Profile Blog Joined August 2004
Poland17800 Posts
Last Edited: 2014-07-19 19:50:02
July 19 2014 19:48 GMT
#9998
On July 20 2014 00:45 berated- wrote:
Show nested quote +
On July 19 2014 23:39 Manit0u wrote:
On July 16 2014 05:46 sob3k wrote:
I' trying to make a MEGA basic contact form that mails an address with the info from a form. I've been using PHP.

Here is the form. Is this ok? Anything I need or don't need here?

<form action="jmailscript.php" method="post">
Name:<br /> <input type="text" placeholder="Name" name="name"><br>
Email:<br /> <input type="text" placeholder="Email" name="email"><br>
Phone:<br /> <input type="text" placeholder="Phone" name="phone"><br>
Property Address:<br /> <input type="text" placeholder="Property Address" name="address"><br>
Property City:<br /> <input type="text" placeholder="Property City" name="city"><br>
Property State:<br /> <input type="text" placeholder="Property State" name="state"><br>
Property Zip:<br /> <input type="text" placeholder="Property Zip" name="zip"><br><br>

<button type="submit" name="submit" value="Submit" class="button" data-type="text" id="submit-btn">Submit</button>
</form>


How would I make a super unsafe simple PHP script to mail an address this info when submit is pressed? I've tried several copy pastes with various levels of complexity and I can't get it to work. I understand very basic PHP syntax and the functions used but I'm clearly not understanding the scripts fully. Also I just learned that apparently you just cannot test mail() on a local server such as Xampp (this could explain some of my failures)? If I just upload it to my domain will that work?

I just want someone to ask a few pointed questions about what certain things are doing.

EDIT: OMFG I did it. very simple when I figured it out

this is my script:

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$from = 'From: My Site';
$to = 'myemail@gmail.com';
$subject = 'Property Information';

$body = "From: $name\n E-Mail: $email\n Phone: $phone\n Address: $address\n City: $city\n State: $state\n ZIP: $zip";

if ($_POST['submit']) {
mail($to, $subject, $body, $from);
echo "Submission Accepted!";
}

?>


Follow up, how would I adjust things to include the script on the form page you it doesn't take you away from the form?


Why are you doing this in pure PHP? If you want pretty bare-bones PHP then go with PHP MVC microframework. Select the advanced version which will give you access to awesome Twig templating engine and Sass for easier styling. And do your forms this way, much easier and you can simply put your script in the controller: http://symfony.com/doc/current/book/forms.html


Generally we need to walk before we run. I'm thinking someone that just figured out a mailto might be a tad overwhelmed with phpmvc and sass.


HTML and CSS you can grasp on a basic level in an hour. PHP MVC you can get the gist of in about 30 minutes (the entire "tutorial" for it consists of just 5 images and explains pretty much everything you should know). It's much better to get into MVC environment early on, as well as more advanced CSS wrappers (like sass or less) and templating engines. It not only prepares you for more advanced stuff (like jumping to a full-stack framework, regardless of programming language) but also makes it way more enjoyable in the beginning since it turns some of the boring stuff that requires a lot of simple code into more managable and easier to write/read/understand parts.

With PHP I think that you don't get much out of learning pure-PHP. I'm now working as a PHP programmer and I can tell you that practically no one ever uses pure PHP or even PHP code in the views. That's why I suggested php-mvc to him, it's easy to get into since there isn't much of the overhead and it'll let you learn the basic principles behind pretty much every single web project and framework. Sure, I could suggest something like Laravel, where you can have a full app running in 15 minutes and 3 lines of code, but that would be detrimental for someone just learning the ropes. The sooner you start learning the proper way of doing things the better and if you can actually use tools that provide an additional layer of abstraction it's even better because it lets you think more on "what I want" rather than "how do I need to do it". Expressiveness is very important.
Time is precious. Waste it wisely.
Cyx.
Profile Joined November 2010
Canada806 Posts
July 19 2014 19:54 GMT
#9999
On July 18 2014 02:11 darkness wrote:
Just wondering, how many of you still play StarCraft and enjoy it? If you don't play it, then which game have you picked nowadays?

I play dota now too... I can play with my friends =P I still like a little starcraft here and there but I'm even worse than I was before... my two games per season tend to land me in gold league these days ^.^
berated-
Profile Blog Joined February 2007
United States1134 Posts
July 19 2014 21:10 GMT
#10000
On July 20 2014 04:48 Manit0u wrote:
Show nested quote +
On July 20 2014 00:45 berated- wrote:
On July 19 2014 23:39 Manit0u wrote:
On July 16 2014 05:46 sob3k wrote:
I' trying to make a MEGA basic contact form that mails an address with the info from a form. I've been using PHP.

Here is the form. Is this ok? Anything I need or don't need here?

<form action="jmailscript.php" method="post">
Name:<br /> <input type="text" placeholder="Name" name="name"><br>
Email:<br /> <input type="text" placeholder="Email" name="email"><br>
Phone:<br /> <input type="text" placeholder="Phone" name="phone"><br>
Property Address:<br /> <input type="text" placeholder="Property Address" name="address"><br>
Property City:<br /> <input type="text" placeholder="Property City" name="city"><br>
Property State:<br /> <input type="text" placeholder="Property State" name="state"><br>
Property Zip:<br /> <input type="text" placeholder="Property Zip" name="zip"><br><br>

<button type="submit" name="submit" value="Submit" class="button" data-type="text" id="submit-btn">Submit</button>
</form>


How would I make a super unsafe simple PHP script to mail an address this info when submit is pressed? I've tried several copy pastes with various levels of complexity and I can't get it to work. I understand very basic PHP syntax and the functions used but I'm clearly not understanding the scripts fully. Also I just learned that apparently you just cannot test mail() on a local server such as Xampp (this could explain some of my failures)? If I just upload it to my domain will that work?

I just want someone to ask a few pointed questions about what certain things are doing.

EDIT: OMFG I did it. very simple when I figured it out

this is my script:

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$from = 'From: My Site';
$to = 'myemail@gmail.com';
$subject = 'Property Information';

$body = "From: $name\n E-Mail: $email\n Phone: $phone\n Address: $address\n City: $city\n State: $state\n ZIP: $zip";

if ($_POST['submit'] {
mail($to, $subject, $body, $from);
echo "Submission Accepted!";
}

?>


Follow up, how would I adjust things to include the script on the form page you it doesn't take you away from the form?


Why are you doing this in pure PHP? If you want pretty bare-bones PHP then go with PHP MVC microframework. Select the advanced version which will give you access to awesome Twig templating engine and Sass for easier styling. And do your forms this way, much easier and you can simply put your script in the controller: http://symfony.com/doc/current/book/forms.html


Generally we need to walk before we run. I'm thinking someone that just figured out a mailto might be a tad overwhelmed with phpmvc and sass.


HTML and CSS you can grasp on a basic level in an hour. PHP MVC you can get the gist of in about 30 minutes (the entire "tutorial" for it consists of just 5 images and explains pretty much everything you should know). It's much better to get into MVC environment early on, as well as more advanced CSS wrappers (like sass or less) and templating engines. It not only prepares you for more advanced stuff (like jumping to a full-stack framework, regardless of programming language) but also makes it way more enjoyable in the beginning since it turns some of the boring stuff that requires a lot of simple code into more managable and easier to write/read/understand parts.

With PHP I think that you don't get much out of learning pure-PHP. I'm now working as a PHP programmer and I can tell you that practically no one ever uses pure PHP or even PHP code in the views. That's why I suggested php-mvc to him, it's easy to get into since there isn't much of the overhead and it'll let you learn the basic principles behind pretty much every single web project and framework. Sure, I could suggest something like Laravel, where you can have a full app running in 15 minutes and 3 lines of code, but that would be detrimental for someone just learning the ropes. The sooner you start learning the proper way of doing things the better and if you can actually use tools that provide an additional layer of abstraction it's even better because it lets you think more on "what I want" rather than "how do I need to do it". Expressiveness is very important.


Yeah -- I probably should have just left it alone. We all learn at different rates. I often find that the people I have worked with have jumped too quickly into a web framework and then miss the base understanding of how request/response/sessions work. They understand the framework but then when they need to modify something about how it might work then there is no idea of even where to start.

How long did it take you to get to the point where you no longer use base php?
Prev 1 498 499 500 501 502 1032 Next
Please log in or register to reply.
Live Events Refresh
Escore
10:00
Season 3 Week 4
escodisco2962
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ByuN 393
IndyStarCraft 128
ProTech77
RushiSC 29
StarCraft: Brood War
Hyuk 3125
Mini 914
Horang2 779
EffOrt 744
Soulkey 452
firebathero 351
Snow 187
actioN 186
hero 159
ggaemo 150
[ Show more ]
JYJ 114
Rush 84
Sharp 69
Hyun 54
Mind 51
Free 44
910 43
Hm[arnc] 41
Aegong 38
Bale 35
soO 35
Barracks 33
Sexy 28
scan(afreeca) 18
Yoon 15
NaDa 14
Shine 12
zelot 12
Rock 12
IntoTheRainbow 12
ajuk12(nOOB) 5
Dota 2
qojqva1287
syndereN344
XcaliburYe49
League of Legends
KnowMe38
Counter-Strike
fl0m3831
Other Games
FrodaN2310
singsing1895
hiko969
B2W.Neo922
Lowko469
Mlord464
crisheroes338
DeMusliM242
TKL 232
Hui .223
ToD171
Liquid`VortiX147
XaKoH 103
Rex91
CosmosSc2 81
QueenE74
C9.Mang069
Trikslyr10
Organizations
StarCraft 2
IntoTheiNu 903
Other Games
WardiTV802
StarCraft 2
angryscii 19
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 15 non-featured ]
StarCraft 2
• StrangeGG 22
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV389
League of Legends
• Nemesis1850
• Jankos1743
• TFBlade622
Upcoming Events
Big Brain Bouts
1h 4m
Soulspirit vs goblin
TriGGeR vs Bunny
OSC
7h 4m
Korean StarCraft League
12h 4m
Afreeca Starleague
13h 4m
RSL Revival
18h 4m
Serral vs SHIN
herO vs Solar
Online Event
1d
Replay Cast
1d 9h
RSL Revival
1d 18h
Clem vs ByuN
Rogue vs Lambo
OSC
1d 21h
WardiTV Weekly
2 days
[ Show More ]
Sparkling Tuna Cup
3 days
INu's Battles
3 days
Cure vs herO
ByuN vs Rogue
PiGosaur Cup
4 days
The PondCast
4 days
Kung Fu Cup
4 days
Patches Events
5 days
Replay Cast
5 days
CrankTV Team League
5 days
Replay Cast
6 days
CrankTV Team League
6 days
Liquipedia Results

Completed

Proleague 2026-07-22
HSC XXIX
Eternal Conflict S2 E3

Ongoing

CSL 2026 Summer (S21)
KCM Race Survival 2026 Season 3
Escore Tournament S3: W4
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
SCTL 2026 Spring
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026

Upcoming

ASL S22 SEASON OPEN Day 2
Escore Tournament S3: W5
ASL Season 22: Qualifier #1
ASL Season 22: Qualifier #2
CSLAN 4
ASL Season 22
Blizzard Classic Cup 2026
HSC XXX
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
Light Tournament 2026
Eternal Conflict S2 Finale
ESL Pro League Season 24
Stake Ranked Episode 4
Logitech G Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #5
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.