A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 24

Thread: PHP Form

  1. #1
    The G5 SP N_R_D's Avatar
    Join Date
    Apr 2004
    Posts
    1,118

    PHP Form

    I am trying to be slick and write this out, but it doesnt seem to want to work.......can some one take a look and see if there is something I missed....

    code:

    //--Actionscript
    mailform = "form.php";
    confirm = "please wait for confirmation ..."
    action = "send";

    function validate (address) {
    if (address.length>=7) {
    if (address.indexOf("@")>0) {
    if ((address.indexOf("@")+2)<address.lastIndexOf(".") ) {
    if (address.lastIndexOf(".")<(address.length-2)) {
    return (true);
    }
    }
    }
    }
    return (false);
    }

    function formcheck () {
    if ((((email == null)) || (email.length<1)) || (email == "ERROR! Address not valid")) {
    email = "ERROR! Address not valid";
    action = "";
    }
    if (!validate(email)) {
    email = "ERROR! Address not valid";
    action = "";
    }
    if (name == null) {
    name = "ERROR! Name required";
    action = "";
    }
    if (tml == null) {
    tml = "ERROR! Name required";
    action = "";
    }
    if ((validate(email)) && (email != "ERROR!") && (message != "")&& (subject != "")&& (name != "") && (tml != "")) {
    trace("GOOD")
    action = "send";
    loadVariablesNum (mailform, 0, "POST");
    play();
    }
    }





    ver basic PHP for right now
    PHP Code:
    <?
     
       $to = "mike@newrealitydesigns.com";
       $msg = "$name\n\n";
       $msg .= "$tml\n\n";
       $msg ..= "$message\n\n";

      mail($to, $subject, $msg, "From: My web site\nReply-To: $email\n");

    ?>

    Typo? Syntax, what is the deal !

  2. #2
    The G5 SP N_R_D's Avatar
    Join Date
    Apr 2004
    Posts
    1,118
    Even more so, is there a way to do this same task in ASP, or something like it?

    I have the site I am working on on the same network as the people who see it, but I need to get it to send a form through a contact area. Any ideas?

  3. #3

  4. #4

  5. #5
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    hello psycho,

    please dont eat my family.

    here is some breathtaking php code.
    Code:
    <?php
    $t= $_POST['t'];
    $s= $_POST['s'];
    $m= $_POST['m'];
    mail($t,$s,$m);
    ?>
    followed by some sassy actionscript
    code:

    for (var i=1;i<=3;i++) {
    this.createTextField("tf"+i,i,0,i*22,200,20);
    this["tf"+i].type="input";
    }
    this.onMouseDown=function() {
    for (var i = 1; i<=3; i++) {
    _level0["tf"+i].text.length>0?trace(_level0["tf"+i].text):trace("BEEP");
    }
    l= new LoadVars();
    l.t=_level0.tf1.text;
    l.s=_level0.tf2.text;
    l.m=_level0.tf3.text;
    l.sendAndLoad("whateveryounamedthefileupthere.php" , l, "POST");
    }



    edit: actually performing the action might be helpful
    Last edited by moagrius; 11-26-2004 at 04:12 PM.

  6. #6
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    here's a vbscript too - im told asp is basically vbscript inside <% tags... i dunno tho, never used it. this works client side anyways (save as whatever.vbs and double click) so i imagine you can probably wrap it in a sub and have at it
    Code:
    Dim t,s,f
    t=  InputBox("to") 
    f=  InputBox("from") 
    s=  InputBox("subj") 
    Set objEmail = CreateObject("CDO.Message")
    objEmail.From = f
    objEmail.To = t
    objEmail.Subject = s
    objEmail.Send

  7. #7
    The G5 SP N_R_D's Avatar
    Join Date
    Apr 2004
    Posts
    1,118
    Cool script, didnt really answer any of the questions though......thanks anyways.




    P.S. Boy are you sensitive......

  8. #8
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Originally posted by N_R_D
    ... didnt really answer any of the questions though...
    Really surprised?

  9. #9

  10. #10
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    That wasn't aimed at you my friend!

  11. #11
    The G5 SP N_R_D's Avatar
    Join Date
    Apr 2004
    Posts
    1,118
    K.....I was a litle worried...dont wanna piss of the Newb !

    Hey OldNewbie.....have any idea what the deal is with my code up there?

    or.....


    <%
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject="Sending email with ASP"
    myMail.From="website@countrywide.com"
    myMail.To="Mike_Sletten@countrywide.com"
    myMail.TextBody="This is a test."
    myMail.Send
    %>


    How the hell to use this little mail code for ASP ??

  12. #12
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Sorry! But I know nothing of server side scripting, and contrary to others, I'm not afraid to admit it! I usually don't post just to show off my scripting abilities, and regarding SSS, I simply have none!

    I can only refer you to this thread, where one of the links could possibly shed some light!

    http://www.flashkit.com/board/showth...hreadid=594250

  13. #13
    The G5 SP N_R_D's Avatar
    Join Date
    Apr 2004
    Posts
    1,118
    once again you come through....

    even if you dont have the answer....you usually have a GREAT place to go get it

    Newb...thanks again !

  14. #14
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Happy Thanksgiving to you to, genius!
    Last edited by oldnewbie; 11-26-2004 at 05:58 PM.

  15. #15
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    nrd: how does that not answer your questions? you use $_POST['var'] to recieve variables send via LoadVars. the dollar sign inside the string is extraneous, but doesn't hurt anything.

    sendandload does everything send does and everything load does, so just use it exclusively. the validation was all superfluous as well.

    [particuarly hurtful flame deleted by jbum]
    Last edited by jbum; 11-27-2004 at 01:42 AM.

  16. #16
    The G5 SP N_R_D's Avatar
    Join Date
    Apr 2004
    Posts
    1,118
    Originally posted by moagrius
    [B]nrd: how does that not answer your questions? you use $_POST['var'] to recieve variables send via LoadVars. the dollar sign inside the string is extraneous, but doesn't hurt anything.

    sendandload does everything send does and everything load does, so just use it exclusively. the validation was all superfluous as well.
    Well, I really just wanted to know what was up with the code I had up.....sounds kinda closed minded but i raelly wanted to know whati did wrong, not just copy and paste some one elses......i figgered it out.....the variable for mailform was misspelled. WOOT for me

    As for the ASP part, i have been killing my self trying to get ASP mail thing to work, but cant...I am a total ASP idiot !

    and it doesnt seem like people who do know about it want to help a newbie out, and everyone else knows just enough to post and cunfuse me. I meant no ill will towards your reply, I always appreciate it when people try to hel[pm, I just need some asp help quick style.



    <%
    response.write(request.form("symptom"))
    response.write(" " & request.form("part"))
    %>

    which return My head hurts if I knew how to MAKE THE SCRIPT WORK !!!!!!!!

  17. #17
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    see im guess i thought the fact that you bumped your own post 3 times meant you needed a solution quickly, not an indepth explanation - as i've mentioned i don't know a thing about asp, but if you want to pursue it with php i'd be glad to help. if you need to do it in asp, sorry but im useless.

    did you try encasing the vbs in <% and %> like i suggested? then i believe you can either save it as a processor (save it as a separate file with a .asp extension and the appropriate chmod, and have your form action point to that file) or use it as a defined function within your page, in a fashion similiar to a javascript function. this is all guesswork, but i'm 90% sure that mail form will work with the tags in place
    Code:
    <%
    Dim t,s,f
    Set objEmail = CreateObject("CDO.Message")
    objEmail.From = f
    objEmail.To = t
    objEmail.Subject = s
    objEmail.Send
    %>
    im also guessing asp works the same as most other scripts for recieving variables; set the id and names of your form elements to reflect the variables... just some suggestions. good luck.

  18. #18
    The G5 SP N_R_D's Avatar
    Join Date
    Apr 2004
    Posts
    1,118
    Yeah I had thought that too...

    Im all good to go with PHP...

    but this server here at work will not allow PHP....

    So I need to get it to work in ASP...




    What is this about CHMOD?

    Does that need to be changed for the asp to work?

  19. #19
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    yes. anything you're doing server side needs chmodd'ed, even image files in the rare instance you might rewrite them...

    its rwe - read write execute - scripts need to be set to execute permissions, files being written to /overwritten /saved need the write attributes set

    you can do this through dos, ie, cute, wise, or xp's ftp. easiest is ie - just browse to ftp://username:password@domain.com with folder view enabled, r-click and check the appropriate boxes
    Last edited by moagrius; 11-26-2004 at 08:26 PM.

  20. #20
    The G5 SP N_R_D's Avatar
    Join Date
    Apr 2004
    Posts
    1,118
    Ok so what if it is client side?

    The flash file, and the asp are on the same network as the viewrs coumputed, but it is accessed through the web. It like an intranet.....is that the problem?

    How can I change the chmod on a file that is not ftped

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center