Question about PHP scripting

i just did a PHP script for a web form, it works fine that
when i press submit, it displays the page said "thanks for
submitting," but the problem is i never receive the email of the
data, any idea?

I agree with GarryCT that you should try a simple test (no
HTML) to see
if you can send mail at all. If that succeeds, then try
building it up
to the point you're hoping for.
When sending HTML mail, you /might/ want to consider
including a plain
text version and sending multi-part email.
Anyway, here are some comments I have for the code posted
here:
Try
temporarily turning on display errors.
> <?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
> /*subject and email variables*/
> $subject = 'php scripting';
> $me = 'my email';
> /*gathering data variables*/
> $name1 = $_POST ['name1'];
> $name2 = $_POST ['name2'];
> $email = $_POST ['email'];
> $company = $_POST ['company'];
> $brief = $_POST ['brief'];
>
> $body = <<<EOD
> <br><HR><br>
> First Name: $name1 <br>
> Last Name: $name2 <br>
> E-mail Address: $email <br>
> Company: $company <br>
> Brief: $brief <br>
> EOD;
Hopefully, that indent was caused by the Web forum.
Otherwise, EOD;
should be at the very start of the line - no white space[1].
EOD;
> $headers = "From: $mail\r\n";
You have not assigned a value to $mail. Some hosts require
this to be
an address in your domain. Try using your $me variable here
(assuming
it is a valid email address from this domain).
> $headers .= "Content-type: text /html\r\n";
Try removing that extra space. You might also need to add
mime
version[2]. Does order make a difference? Try this for the
$headers
variable:
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' .
"\r\n";
$headers .= "From: $me\r\n";
> $success = mail($me, $subject, $body, $headers);
You are not acting on the TRUE/FALSE result stored in
$success.
Everything after this point assumes mail was accepted for
delivery. Of
course, TRUE does not necessarily mean the mail actually got
to its
intended destination[2], FALSE does indicate that it was not
delivered
at all.
> /*results rendered as HTML*/
> $theResults = <<<EOD
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
> "
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>Untitled Document</title>
> </head>
> <body>Thanks for your time, we'll get back to you
within a day.
> </body>
> </html>
> EOD;
Hopefully, that indent was caused by the Web forum.
Otherwise, EOD;
should be at the very start of the line - no white space[1].
EOD;
> echo "$theResults";
> ?>
[1]
http://php.net/echo (see "here
document" in examples.)
[2]
http://php.net/function.mail
Mark A. Boyd
Keep-On-Learnin' :)

Similar Messages

  • Question about calculation script 'Fix'

    Hi Guys,
    I have a question about calculation script 'Fix'. Below is the sample for my question:
    Dimension 'Period' has members '2009','2010','2011'. We want to Fix the data which 'Period' is not '2009'.
    From Database Administrator's Guide we could use @NOTEQUAL, but version 11.1.1.3.0 seems not support @NOTEQUAL.
    Actually, the dimension is dynamic so we cannot use the way fixing other memebers. What should I do for this requirement?
    Edited by: 842270 on Apr 24, 2011 7:29 PM

    842270 wrote:
    Hi Guys,
    I have a question about calculation script 'Fix'. Below is the sample for my question:
    Dimension 'Period' has members '2009','2010','2011'. We want to Fix the data which 'Period' is not '2009'.
    From Database Administrator's Guide we could use @NOTEQUAL, but version 11.1.1.3.0 seems not support @NOTEQUAL.
    Actually, the dimension is dynamic so we cannot use the way fixing other memebers. What should I do for this requirement?
    Edited by: 842270 on Apr 24, 2011 7:29 PMYou can use @Remove command to avoid 2009.
    @REMOVE
    Removes values or members in one list from another list.
    Syntax
    +@REMOVE (list1, list2)+
    Parameter     Description
    list1
    +     A list of member specifications, from which the members specified in list2 are removed.+
    list2
    A list of member specifications to be removed from list1.

  • Question about PHP

    I am completely new to programming and have enjoyed Linux so much, that I would like to go into PHP next. Currently I am a University student with a dead end major (Russian Studies). I am looking to get a certificate in PHP over the course of this next year and to find a little better job with it than I could get with my current degree. I would do a Google search for this, however, I have come to like Arch and the community that surrounds it and wanted to know if any you fine web programmers out there, had any suggestions for free online courses in PHP or book that could be purchased. I was also wondering what a good PHP certification exam to take would be. I have seen the Zend exam and was considering doing a test prep for this after I learn a little more about PHP and SQL. Thank you for your help and suggestions!

    Berticus wrote:
    As  I said, to most people, taxonomy doesn't matter.  It does matter to other people, and I don't mean people like me who have these little pet peeves.
    It matters to people who know a lot of languages who need to know when to use what language.  There isn't a single programming or scripting language that can be everything, so it's important for people, mostly software engineers, to know taxonomy, so they can pick a language most optimal for what they need to get done.  Most of the time, when you're dealing with very complex systems.  Instead of using one language for the whole system, you'll find out you'll be using COBRA to handle hardware, C++ to handle interface and C to tie everything together or something like that.
    I mean when you're differentiating between an interpretted language (script) and a program, the issue is efficiency and speed.  No matter what you do, an interpretted language is inherently slower and less efficient than a programming language.  Even Java that is compiled, is compiled to Java Native Language or something like that, and requires the Java Virtual Machine to interpret it (that's why Java gets it's own branch).  I believe it's the fastest interpretted language, but how does it compare to a natively compiled program?  It's still slower.
    Even when you know you're going to use a programming language, you still have choices, because each programming language can be split into a high, middle, and low level language.  Reasons for using different levels are due to how quickly do you need to write the program, how portable does the program need to be, how easy should other people be able to read the program, does it need to have low level abilities such as handling memory directly.  Then there's also the question about how your program is going to flow.  Is it functional or object oriented?
    It's not so much an opionated matter when you think about it.  It's more along the lines of do you need this knowledge or not?  For most people, I'm willing to bet that's everybody who posts in this thread, that information is not important, they don't need to know it, because they handle very, very simple applications compared to the complex systems that do indeed require the programmer or scripter to know the difference.
    Actually, the difference between interpreted and compiled (and faux-compiled) languages is different from the difference between programming and scripting languages, interpreted languages can also be programming languages, and compiled languages can be scripting (although this happens very little and is really pointless and tedious to do )
    'Scripting' usually refers to code meant to extend upon a framework or program separate from the script itself, whereas 'programming' is creating applications that are on their own, separate applications, regardless of whether they're run though an interpreter at runtime. The difference is a bit vague, and you are right in that interpreted languages are often used for scripting, but it is not necessary, look at something like python, this can be used both as scripting for automating tasks quickly by using it's immense library, as well as for creating stand alone applications, which would be programming. (PHP is virtually always scripting, though)
    Either way I prefer the term 'coding'

  • Quick question about PHP sessions and Air app

    Could someone clear this up for me?
    My air app makes html requests to php scripts, php login, search etc. I've been advised to use sessions in the php scripts to ensure each request to a script is done by a logged in user.
    So is the session identifier stored automatically by air somewhere, similar to a cookie in a browser?

    4.4.1 is indeed the version of php in 10.4.6, but it's also the version of php that's running on my 10.3.9 server. You can execute php -v on your server to see which version you've got, but it seems unlikely that it's a version other than 4.4.1 if you haven't updated it yourself. Are there security updates you haven't applied?

  • Questions About PHP

    I guess this is the best place to post this since my problems are with php and xml, and with compiling c code. I'm using the Phoronix Test Suite, which is entirely PHP based (you need to install the php package, not a whole webserver for it to work) and pretty poorly documented, and if you want to use extra features that dont come with the main package you have to install them yourself which is a major roadblock from someone like me who knows absolutely nothing about PHP. The program itself works fine, the problems I have are with using the additional features. Ive posted a thread over there yesterday but their forum doesnt seem to be that active.
    First off to export your results to a pfd file you have to have the fpdf module (fpdf.php) but I have no idea where to put it, Ive googled it but all ive found is that you can put it anywhere that include() can look but I have no idea where include CAN look lol. Ive looked through /etc/php/php.ini and a few of the php files for the PTS but cant find it defined anywhere. Ive put it where all the other php modules are in /usr/lib/php/modules but when I try to use the module in PTS via phoronix-test-suite result-file-to-pdf it says that I need to have the fpdf program installed for it to work.
    Second problem (?) I have is with viewing the results in a web browser. After a benchmark completes it asks you if you want to view the results in a web browser and if I select yes the results are shown but theyre nearly impossible to read since its all one big block of text with no spaces. The results are stored in an xml file called composite.xml and there are two other xml files in the same folder called pts-results-viewer.xsl and test-1.xml (which is just another results file from a previous test), there is also an html file called index.html which just references the composite.xml file in its code. I know very little about HTML and XML but almost everytime Ive tried to load an xml file in a web browser it displays either the source of the file or just a big unformatted block of text, so I dont know if this is really an error or if its supposed to be like this.
    The third problem I have is with php-gtk. If I simply install the php-gtk package with pacman it installs fine but when I try to load the program from the console using phoronix-test-suite gui its gives me the following errors:
    PHP Warning: PHP Startup: php-gtk: Unable to initialize module
    Module compiled with module API=20060613
    PHP compiled with module API=20090626
    These options need to match
    in Unknown on line 0
    The PHP GTK module must be loaded for the GUI.
    This module can be found @ http://gtk.php.net/
    I remember reading that php-gtk from the aur said that it used a modified php-gtk.ini and that I should tell all the programs to use that file instead of the default one, so with the php-gtk package installed via pacman I tried to open the program via php-gtk -c /etc/php/php-gtk.ini /usr/share/phoronix-test-suite/pts-core/phoronix-test-suite.php, it says the same thing.
    If I try to compile php-gtk from source using aurbuild the compilation errors out about 85% of the way through (right at the GTK Coverage portion) with about 100 or so error: duplicate 'static' errors in various header files. Ive tried everything that I cant think of to try and remedy this but nothing seems to work.
    These are the things that Ive tried:
    building dependencies from the aur
    syncing dependencies from pacman
    removing the php package that I installed via pacman and building it with aurbuild --build-deps php52 (the package named php had errors in the pkgbuild so i used php52 and changed the package name to php in the pkgbuild) and then building php-gtk
    following this guide to make sure that I have all the dependencies that I need and that they are compiled/installed in the order that they should be.
    None of which have worked, they all give the same errors. The only thing I havent tried is manually compiling everything without using abs/aurbuild and following the instructions on the page I linked to.
    In case its helpful, heres the php modules that are loaded:
    [PHP Modules]
    Core
    ctype
    date
    dom
    ereg
    fileinfo
    filter
    gd
    gettext
    hash
    libxml
    mbstring
    mysqlnd
    pcntl
    pcre
    posix
    readline
    Reflection
    session
    SimpleXML
    SPL
    standard
    tokenizer
    xml
    xmlreader
    xmlwriter
    zlib
    [Zend Modules]
    Can anyone clue me in on any of this?
    Last edited by brando56894 (2009-10-07 00:35:27)

    Thanks for the info, I finally got the gui to work I manually compiled (almost) everything, stuff that errored out I cheated and installed with pacman and gtk-php finally compiled successfully, the pkgbuild I was initally using probably didnt include some of the flags that were needed. I had to use the configure flag --disable-gtktest while I was configuring php-gtk or else it would complain that gtk+ >= 2.6.0 wasnt installed even though I have gtk-2.16.5-1 installed.
    After about 2 hours of downloading and compiling it still gave me the API error I mentioned before, needless to say I wasnt too happy. I googled again and found a bug-report about the same error and it said that its usually do to leftover files from an older installation. One person mentioned when they upgraded from ubuntu edgy to feisty-beta they got this error and found out that an old version of the php binary was there and the newest one was called php5 so they removed the old one and made a link from php5 to php. Just for the hell of it I checked out my /usr/bin for the same problem, it wasnt that obvious though. php was there, php-config was there and the link I had just created called php-gtk2 was there.
    The previous two were from 9/27/09 while the link was obviously from today. I added .old to the names of php and php.conf and made a link from /usr/local/php-5.2.3/bin/php -> /usr/bin/php, added extension=php_gtk2.so to /etc/php/php.ini (actually it was already there from when I was messing around before) and ran phoronix-test-suite gui and finally it worked.
    I tried place fpdf.php in my modules directory but its still not finding it and it (and i) are gettting confused since the tutorial I was following installed stuff into /usr/local/php-gtk-2.01 and not the default location. I'm going to go into my other installation and see if I can get everything to work with just pacman since I know what (one of the) actual problem(s) is. If not Im going to create a pkgbuild for it because this was a HUGE pain in the butt.
    Heres the composite.xml, the PTS-results-viewer.xsl and the Index.html

  • Question about multiple Script declarations

    I'm reading Flash Builder 4 and Flex 4 Bible.
    On page 121 it states:
    "Any particular <fx:Script> element can contain nested ActionScript or use the source property to link to an external Actionscript file, but it cannot do both at the same time. You can, however, have as many <Script> declarations in a single MXML file as you need>"
    My questions are about the last sentence.
    1)  They specifically used <fx:Script> and <Script>. Are these two different entities?
    2)  I've never seen examples of using multiple <fx:Script> declarations in a project. How would this work?
    3)  Are they promoting bad practices by making this claim?
    Thank you
    Kristin

    Although multiple script tags are allowed, I'd guess that they're not commonly used.
    Gordon Smith
    Adobe Flex SDK Team

  • Question about simple script?

    Hello,
    I would like to write a small program/script and am looking for advice on how to do so. I do not have a preference about which method or language to use, hopefully looking for the simplest way to do this (if it works with Windows or DOS command line this is
    preferable).
    I have a program that runs on text files e.g. "program file1.txt file2.txt"
    I have 20 folders that each have 5-10 text files. I want to automatically get the name of the largest size text file from each of the 20 folders, and then run the program on these 20 files as described above.
    Ideally I could point my script to a folder, and it will automatically find the largest .txt file in each of the subdirectories and run "program file1.txt file2.txt file3.txt ..."
    Any ideas on how to most efficiently accomplish this? Ideas or links to tutorials if applicable are helpful.
    Thank you

    Yes this is very helpful, thank you so much. I have a couple of questions:
    What I am doing is actually running a perl wrapper that calls a java program, so my command looks something like this and it works fine if I enter multiple full path file names without quotes:
    perl Program C:\Folder1\Subfolder1\file1.txt C:\Folder1\Subfolder2\file2.txt C:\Folder1\Subfolder3\file3.txt
    The script as you described above does exactly what I am hoping for. For the $Path variable, I would like to either
    1) have this script begin from the directory that is it run from so if I copied it to C:\Folder1\ then it would run the command as shown above, or
    2) allow for a parameter to be passed to it with the path of the directory to begin from e.g. "powershellscript.ps C:\Folder1"
    How would I go about doing this?
    So I believe the last line of this script would be:
    perl Program ($Results -join " ")
    Does this make sense? If so I will give it a try. Thanks again.

  • Question about unix script

    Hi all,
    I know this is not the question for this forum but in case :)) if somebody knows.
    I have a shell script to run this completely I need to enter two times if I run it mannually. Now I want to automate that script and want to call that script from another script. Will anybody tell me how to automate 2nd carriage RETURN.
    Thanks in Advance
    Aqil

    > It doesnot give me any error but it doesnt work.
    When I asked "Does that work?" I meant does that approach work in general? i.e. can you ever have a background command as the subject of a here-document construction? I don't see how that could work, because once the command is kicked off in background in a separate process, how can you feed the rest of the input to it? It would make more sense to write
    needcarriagereturn.sh <<END
    END
    ) &or
    function runmyscript
              needcarriagereturn.sh<<-END
              END
    runmyscript &or perhaps
    echo | needcarriagereturn.sh &Message was edited by:
    William Robertson
    Ignore the ">" character in the middle example. The forum software adds it for some reason.

  • Problem about php script

    could i ask php question here?
    because there few people on Forum: PHP
    who can help me?

    Hi
    What is your question?
    Ott Karesz
    http://www.trendo-kft.hu

  • Question about using script library

    Dear Mavens,
    I am writing a script that has lots of predefined text items because it deals with reprocessing certain javascript files.
    Here is an example from the beginning of the script (with the actual javascript code mangled because it seems to mess up the display):
    set sdinTXTcf_imgsrc to "<i_mg src=dfaasfaf"<P>
    set sdinTXTcf_onload to " onLoad="p_arent.frames[1].readystate(sfsafasfads"
    set sdinTXTcf_inBetween to "</d_iv>');
    } else {
    parent.frames[0].document.write('<div align="c_enter"><img src=\""
    this section is now getting quite long and I thought of putting it into an external file. What I was hoping to do is to load all these "set this to that" commands into my script then use them as if they had been defined in it.
    The following is a toy script to demonstrate my problem.
    I wrote a mini library which ilooks thusly:
    set var1 to "VAR1"
    set var22 to "VAR22"
    set var333 to "VAR333"
    Then a mini script that calls the mini library:
    load script file "whatever:toylib.scpt"
    get var1
    The result is
    tell current application
    load script file "whatever:toyscript.scpt"
    set var1 to "VAR1"
    set var22 to "VAR22"
    set var333 to "VAR333"
    "The variable var1 is not defined."
    setting up var1 as global does not help either, either in the scrip or in the library
    Now, I can set up the mini library script as a subroutine to be called, such as
    on toy()
    set var1 to "VAR1"
    set var22 to "VAR22"
    set var333 to "VAR333"
    return {v1:var1, v22:var22, v333:var333}
    end toy
    and in the main scipt I can do a
    set loaded to load script file "whatever:toylib.scpt"
    tell loaded
    set var1 to v1 of toy()
    end tell
    get var1
    which works but it is actually more cumbersome than simply having to scroll down dozens of lines of code on the top of the script.
    I'm sure I'm missing somethig here, your help will be appreaciated
      Mac OS X (10.4.8)  

    Hi Asu,
    There are several ways to do this. The easiest is to
    use properties. Your script library might look like
    this:
    property var1 : "VAR1"
    property var22 : "VAR22"
    property var333 : "VAR333"
    You might load it and get values like this as an
    example:
    set f to choose file -- the script to load
    set s_lib to load script f
    var22 of s_lib
    Note that this is not the only syntax.
    When you do things like 'set' in the script library,
    you need to run the loaded script or subroutines
    within it.
    gl,
    It worked. THANKS!

  • Question about fx:Script

    Hi,
    I have a form using many functions of calculations in fx:Script.
    Can I create a separate file with part of my fx:script? it is getting to long.
    If I can separate this file, can I use this in a different form?
    Thanks!

    You can use the source property:
    <fx:Script source="scripts.as"/>

  • [SOLVED]A simple question about bash scripting

    Just for fun, I thought I'd try making Arch as "parent friendly" as possible (i.e., easy to use once set up).  I've already made a nifty little "system maintenance" script that presents you with a "select" bash menu, with options being "Install, Remove, Update [Without AUR, with AUR, abs, exit], Search, Install and Search (using Yaourt), and exit"
    That works wonderfully, and it only requires typing "sm" into the terminal.
    But just to make it yet *more* "parent friendly", I thought I'd make a .desktop file.
    This is the problem.
    I want the shortcut to essentially open up the script in a terminal.  So it would have to execute, say, "xterm" and then open the "sm" script within the called terminal.
    I believe this would mean I need to either add something to my "sm" script or make a new script that opens terminal and calls sm.
    I'm sure this has an easy solution, but I'm a total amateur just having some fun.
    Any suggestions?
    Last edited by hwkiller (2010-07-13 00:32:48)

    I am not a 100% on .desktop files since I never use them.
    but if your command in the desktop file is something like
    xterm -e /path/to/your/sm/file
    that should work.
    EDIT: Bah too late !
    Last edited by Inxsible (2010-07-12 19:27:11)

  • A question about action script 2

    hi all , i do a game with as2 (its an escape game) i have stuck somewhere in as 2. if u help me i will be glad.İ am begginer at flash yet pls help
    i use this code for i take the item to my inv:
    its object code in my inv:
    onClipEvent (load) {
                this.tabEnabled = false;
                this._visible = false;
                orig_x = this._x;
                orig_y = this._y;
    on (press) {
                this.startDrag();
    on (release) {
                this.stopDrag();
                this._x = orig_x;
                this._y = orig_y;
    if (eval(this._droptarget) == _level0.yuk) { 
                            _global.lantern = 1;
                            this._visible = false;
      _level0.gotoAndStop(5);
    its normal object code:
    onClipEvent (load) {
                this.tabEnabled = false;
                if (_global.lantern == 1) {
                            this._visible = false;
    on (release) {
                _global.lantern = 1;
                this._visible = false;
                _level0.lantern_inv._visible = true;
    problem is that my objects doesnt show everyframe in my inventory.
    e.t.c. in frame 1:i take object to my inventory but in second frame:it doesnt show in inventory i wanna player can take object his inv and use it other rooms in my game  didnt able to solve the prob. with layers if u help me i will be glad.
    (sorry for eng)

    i solved problem with that:
    i used variables and after that i dont see two times to my objects at any frame.Coz variable was work.i did keyframes my all frames at layers.Last time i deleted my objects from other frames
    finally:i take one object from 1st frame , use it at 3th frame.Works for now thanx for help
    if i paste my codes to timeline it says:this codes only work for movie clips e.t.c. problem solved for now i hope.
    i like you all ! alwayz need your help

  • A question about SAP script

    Consider a main window, can its width & length be changed/different with first page?

    Most of the time main window in first page will have diffrent position and second page onwards it will have diffrent position .
    one example :
    sales order details - want to print layout form
    requirement will be customer address should be in first page and body will be in first page and next page also.
    first page - we will print customer address and body
    next page onwards we will not print customer address and main window will have more space ,so here we need assign diffrent position.

  • Simple question about mount and delay script

    Hello, I have a simple question about mounting volumes on start up.
    My computer wakes up auto - and then auto there are serveral applescript tasks (mount and start up programs)
    I use this script (daily) for serveral connections with external volumes I always need the connect to. ( In the script I use this code 3 times for other locations) I do this on start up.
    set Uname to "XXX"
    set Pword to "XXX"
    set someVolume to "afp://XXX.XXX.XXX.XXX/XXX/XXX
    mount volume someVolume as user name Uname with password Pword
    (same code for 2 other locations)
    When i do this on start up sometimes the script says there is no connection possible. I guess it's because on start up the connection isn't there. And 1 minute later when computer is total ready the connection is ok. When I run the script then It works. Just sometimes ( In the morning) 'It' want to connect but the script stops. When i do it manually(I run the script again) it works just fine.
    Is it possible that I need a delay? Can someone explain this?
    How would I make a delay handler for this script? Is that the best solution?
    Thanks in advance. This is something small i'm wondering about.
    Colin

    BTW, If you saved the script as an application +(and not as an application bundle)+ you could drop the script on to *Drop Script Backgrounder* (freeware).
    Then the script would run in the background, so, you wouldn't see it running in the Finder.
    <http://www.macupdate.com/info.php/id/7922/drop-script-backgrounder-x>
    Tom

Maybe you are looking for

  • Podcast name is not showing up in itunes

    The name of my podcast is no longer showing up in iTunes. Is there a fix for this?

  • Drag and Drop Problem in Card Game

    Hi, everyone, I'm trying to adapt the memory game in chapter 3 of the book "ActionScript 3.0 Game Programming University" for my own uses. I want to get all of the cards to flip and drag. I am able to flip the first card and drag it, but when I flip

  • To change the printer name

    Hi, I have a requirement to change the printer name when the user tries to send the invoice with the same o/p type second time also.How to change the printer name?

  • Is it possible to call web service in workflow?

    Hi All, Can any one let me know is it possible to invoke or use webservice in workflow? and also want to know is it possible to syndicate few attributes using webservice? Thanks Rajeev

  • Getting firmware update error. disk write error message

    i installed the lastest ipod shuffle update and when I try to restore ipod shuffle I get the error message "firmware update error. disk write error" have no idea what to do. ipod does not show up in itunes