AnimeGalleries [dot] NetAnimeWallpapers [dot] ComAnimeLyrics [dot] ComAnimePedia [dot] ComAnimeGlobe [dot] Com


User Tag List

Closed Thread
Page 1 of 2 1 2 LastLast
Results 1 to 25 of 27

Thread: [Help - PHP] Posting php to xml

  1. #1
    boopaloop! IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS's Avatar
    Gil
    25,635.11
    Gender
    My Mood
    Angelic
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    05-12-2012 02:03 PM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jan 2009
    Location
    I live in South Africa, Kempton Park, Birchliegh
    Age
    35
    Threads
    17
    Posts
    1,037
    Rep Power
    1177

    Default [Help - PHP] Posting php to xml

    can anyone here maybe help me with this, posting data gathered from php to an xml file please?

    Millionaire Campaign:
    Making millionaires out of everyone


    This was unknowingly
    brought to you
    by .Elmer
    and knowingly
    sponsored by Baka Baka!!!



    avi made by my sweet cousin .Elmer


  2. #2
    Copyright © 2013 FS FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD's Avatar
    Gil
    6,638.20
    Gender
    My Mood
    Lonely
    Gifts Fuuko Starfish Ice Cream Bamboo Cup
    Mentioned
    215 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    12-19-2023 07:16 AM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jun 2005
    Location
    I would like to know that too. O_o;;
    Age
    39
    Threads
    162
    Posts
    2,921
    Blog Entries
    5
    AW Wallpapers
    3
    Rep Power
    2200

    Default

    I'm not sure I understand what you are asking ... do you mean using PHP to generate an XML file?

  3. #3
    4: [Classified brah] Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris's Avatar
    Gil
    101,951.98
    Gender
    Gifts Tuxedo Mask Rose Mario Question Block Pen
    Mentioned
    301 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    03-06-2015 01:53 AM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Aug 2001
    Location
    Tau Ceti V
    Age
    37
    Threads
    617
    Posts
    19,697
    Blog Entries
    620
    Rep Power
    14769

    Default

    Quote Originally Posted by FlashD View Post
    I'm not sure I understand what you are asking ... do you mean using PHP to generate an XML file?
    If this is what you're trying to do, simply add

    Code:
    header("content-type: text/xml");
    Somewhere in the beginning of your code (i.e. before you write any data).



    Hey look, Japan made a movie about me!

  4. #4
    Senior Member Miss Moonlight has a reputation beyond repute Miss Moonlight has a reputation beyond repute Miss Moonlight has a reputation beyond repute Miss Moonlight has a reputation beyond repute Miss Moonlight has a reputation beyond repute Miss Moonlight has a reputation beyond repute Miss Moonlight has a reputation beyond repute Miss Moonlight has a reputation beyond repute Miss Moonlight has a reputation beyond repute Miss Moonlight has a reputation beyond repute Miss Moonlight has a reputation beyond repute Miss Moonlight's Avatar
    Gil
    196.61
    Gender
    Gifts Cake Crisis Mooncompact Cancer
    Mentioned
    50 Post(s)
    Tagged
    1 Thread(s)
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    May 2006
    Location
    USA
    Age
    41
    Threads
    78
    Posts
    4,532
    Blog Entries
    308
    Rep Power
    6703

    Default

    There is a way to post XML data from PHP, maybe this would help, but i'm not sure of exactly what you're trying to do.
    月の光は愛のメッセージ

  5. #5
    boopaloop! IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS's Avatar
    Gil
    25,635.11
    Gender
    My Mood
    Angelic
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    05-12-2012 02:03 PM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jan 2009
    Location
    I live in South Africa, Kempton Park, Birchliegh
    Age
    35
    Threads
    17
    Posts
    1,037
    Rep Power
    1177

    Default

    hmmm I'm not really sure my boss wants this done, he didn't really give me any details, but the conclusion I came to is he wants me to take data gatherd from a post page, a page where we gather data from clients like name, surname, id number, eamil address etc. and put that into xml format and then link it to a URL given to us by the sponsor on a remote server. I know this all sounds pretty confusing but I myslef don't really get whats going on.

    Millionaire Campaign:
    Making millionaires out of everyone


    This was unknowingly
    brought to you
    by .Elmer
    and knowingly
    sponsored by Baka Baka!!!



    avi made by my sweet cousin .Elmer


  6. #6
    Copyright © 2013 FS FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD's Avatar
    Gil
    6,638.20
    Gender
    My Mood
    Lonely
    Gifts Fuuko Starfish Ice Cream Bamboo Cup
    Mentioned
    215 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    12-19-2023 07:16 AM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jun 2005
    Location
    I would like to know that too. O_o;;
    Age
    39
    Threads
    162
    Posts
    2,921
    Blog Entries
    5
    AW Wallpapers
    3
    Rep Power
    2200

    Default

    Quote Originally Posted by Miss Moonlight View Post
    There is a way to post XML data from PHP, maybe this would help, but i'm not sure of exactly what you're trying to do.
    Then this is what you need, just use the try, catch function or else curl might give you headaches with errors when the data stream won't be available.

  7. #7
    boopaloop! IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS's Avatar
    Gil
    25,635.11
    Gender
    My Mood
    Angelic
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    05-12-2012 02:03 PM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jan 2009
    Location
    I live in South Africa, Kempton Park, Birchliegh
    Age
    35
    Threads
    17
    Posts
    1,037
    Rep Power
    1177

    Default

    Okay I tried the code miss moonlight linked me too, but I don't quite understand how it works. I have never done XML before and I have no idea how to use it, my boss wants me to take the information from this page
    https://www.ratesdirect.co.za/insura...ontactform.php
    and then post it in a xml format that's suppose to go to this link https://www.outsurance.co.za/OLL/goleadtest.asp
    Last edited by IFS; 10-06-2009 at 01:58 AM.

    Millionaire Campaign:
    Making millionaires out of everyone


    This was unknowingly
    brought to you
    by .Elmer
    and knowingly
    sponsored by Baka Baka!!!



    avi made by my sweet cousin .Elmer


  8. #8
    Copyright © 2013 FS FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD's Avatar
    Gil
    6,638.20
    Gender
    My Mood
    Lonely
    Gifts Fuuko Starfish Ice Cream Bamboo Cup
    Mentioned
    215 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    12-19-2023 07:16 AM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jun 2005
    Location
    I would like to know that too. O_o;;
    Age
    39
    Threads
    162
    Posts
    2,921
    Blog Entries
    5
    AW Wallpapers
    3
    Rep Power
    2200

    Default

    I'm assuming the "xmlcontactform.php" script is the one you are building.

    I'll make an example of the script for the first entry(first name):
    PHP Code:
    <?php
    // when you press the submit button this part is processed
    if( $_REQUEST['action'] == "xml" )
    {
         
    // this is where we add the gathered data from the form below
         
    $xml "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
         
    $xml .= "<CustomerData>\n\t<FirstName>" $_POST['firstname'] . "</FirstName>\n</CustomerData>";

         
    // this is a function that will save the content to a normal XML file
         
    saveToFile($xml);
    }

    // this prints the form as you have it on your site (only the first name though)
    print "<html>
    <body>
    <form action=\"
    $PHP_SELF?action=xml\" method=\"post\" enctype=\"multipart/form-data\">
    <input type=\"text\" name=\"firstname\"><p>
    <input type=\"submit\" value=\"Submit\">
    </form>
    </body>
    </html>
    "
    ;
    ?>
    Then it's up to your client to link his "goleadtest.asp" script to your XML file.

    cURL is a function when you have to gather data from another site and in your situation can't help you.

    Hope this helps you a little. ^_^
    Last edited by FlashD; 10-06-2009 at 04:49 PM. Reason: Fixed the typo

  9. #9
    boopaloop! IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS's Avatar
    Gil
    25,635.11
    Gender
    My Mood
    Angelic
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    05-12-2012 02:03 PM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jan 2009
    Location
    I live in South Africa, Kempton Park, Birchliegh
    Age
    35
    Threads
    17
    Posts
    1,037
    Rep Power
    1177

    Default

    thanks alot man, all this is greatly appreciated


    ps. I just tried the code you gave me in a test page and I got this error

    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /usr/wwws/users/ratesg/insurance/carinsurance/test.php on line 7

    I have no idea what this means.
    Last edited by IFS; 10-06-2009 at 07:29 AM.

    Millionaire Campaign:
    Making millionaires out of everyone


    This was unknowingly
    brought to you
    by .Elmer
    and knowingly
    sponsored by Baka Baka!!!



    avi made by my sweet cousin .Elmer


  10. #10
    Copyright © 2013 FS FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD's Avatar
    Gil
    6,638.20
    Gender
    My Mood
    Lonely
    Gifts Fuuko Starfish Ice Cream Bamboo Cup
    Mentioned
    215 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    12-19-2023 07:16 AM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jun 2005
    Location
    I would like to know that too. O_o;;
    Age
    39
    Threads
    162
    Posts
    2,921
    Blog Entries
    5
    AW Wallpapers
    3
    Rep Power
    2200

    Default

    My code doesn't work as is. I wrote it only as an example. It's missing the function saveToFile() which writes the data into a file.

    The error shown is because of this line
    PHP Code:
     $xml .= "<CustomerData>\n\t<FirstName>$_POST['firstname']</FirstName>\n</CustomerData>"
    It should be:
    PHP Code:
     $xml .= "<CustomerData>\n\t<FirstName>".$_POST['firstname']."</FirstName>\n</CustomerData>"
    Just to see if the XML works use this one:
    PHP Code:
    <?php
    // when you press the submit button this part is processed
    if( $_REQUEST['action'] == "xml" )
    {
         
    // this is where we add the gathered data from the form below
         
    $xml "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
         
    $xml .= "<CustomerData>\n\t<FirstName>${_POST['firstname']}</FirstName>\n</CustomerData>";

         
    // this is a function that will save the content to a normal XML file
         
    print $xml;
         die();
    }

    // this prints the form as you have it on your site (only the first name though)
    print "<html>
    <body>
    <form action=\"
    $PHP_SELF?action=xml\" method=\"post\" enctype=\"multipart/form-data\">
    <input type=\"text\" name=\"firstname\"><p>
    <input type=\"submit\" value=\"Submit\">
    </form>
    </body>
    </html>
    "
    ;
    ?>

  11. #11
    boopaloop! IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS's Avatar
    Gil
    25,635.11
    Gender
    My Mood
    Angelic
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    05-12-2012 02:03 PM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jan 2009
    Location
    I live in South Africa, Kempton Park, Birchliegh
    Age
    35
    Threads
    17
    Posts
    1,037
    Rep Power
    1177

    Default

    thanks for all the help with this, I have another question, what if I create and xml file with empty fields you know just <firstname></firstname> etc. and then by clicking the continue button it adds the data to the xml file and then sends it to the link I got

    Millionaire Campaign:
    Making millionaires out of everyone


    This was unknowingly
    brought to you
    by .Elmer
    and knowingly
    sponsored by Baka Baka!!!



    avi made by my sweet cousin .Elmer


  12. #12
    Copyright © 2013 FS FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD's Avatar
    Gil
    6,638.20
    Gender
    My Mood
    Lonely
    Gifts Fuuko Starfish Ice Cream Bamboo Cup
    Mentioned
    215 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    12-19-2023 07:16 AM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jun 2005
    Location
    I would like to know that too. O_o;;
    Age
    39
    Threads
    162
    Posts
    2,921
    Blog Entries
    5
    AW Wallpapers
    3
    Rep Power
    2200

    Default

    You can do that, but it will just make things more complex, because you will have to write a function that is able to read your empty file. My suggestion is to hardcode the fields as I showed you and then make a saveToFile() function that reads the already created XML file (so the old data are not overwritten) and adds the new data to it.
    Last edited by FlashD; 10-07-2009 at 03:36 PM.

  13. #13
    4: [Classified brah] Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris's Avatar
    Gil
    101,951.98
    Gender
    Gifts Tuxedo Mask Rose Mario Question Block Pen
    Mentioned
    301 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    03-06-2015 01:53 AM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Aug 2001
    Location
    Tau Ceti V
    Age
    37
    Threads
    617
    Posts
    19,697
    Blog Entries
    620
    Rep Power
    14769

    Default

    Quote Originally Posted by FlashD View Post
    You can do that, but it will just make things more complex, because you will have to write a function that is able to read your empty file. My suggestion is to hardcode the fields as I showed you and then make a saveToFile() function that reads the already created XML file (so the old data are not overwritten) and adds the new data to it.
    Sounds like a really awkward solution. In general, temp files and web programming do not go well together. Not only will you get uniqueness problems (what if two users simultaneously use the form? this is solvable, but it's gonna be ugly). A bigger problem is, what if the user doesn't hit submit? Then a temporary file will litter your server forever.



    Hey look, Japan made a movie about me!

  14. #14
    Copyright © 2013 FS FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD's Avatar
    Gil
    6,638.20
    Gender
    My Mood
    Lonely
    Gifts Fuuko Starfish Ice Cream Bamboo Cup
    Mentioned
    215 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    12-19-2023 07:16 AM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jun 2005
    Location
    I would like to know that too. O_o;;
    Age
    39
    Threads
    162
    Posts
    2,921
    Blog Entries
    5
    AW Wallpapers
    3
    Rep Power
    2200

    Default

    Eris has a point here. If two sessions write to the file at the same time one of the two will be lost. To avoid this, the best way is to use a database. You can use two PHP files, one that writes to the DB, while the other works as an XML builder, which gets this data from the DB and outputs it in XML format. This second script would also work as the file the second server links to.
    Last edited by FlashD; 10-07-2009 at 04:46 PM.

  15. #15
    boopaloop! IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS's Avatar
    Gil
    25,635.11
    Gender
    My Mood
    Angelic
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    05-12-2012 02:03 PM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jan 2009
    Location
    I live in South Africa, Kempton Park, Birchliegh
    Age
    35
    Threads
    17
    Posts
    1,037
    Rep Power
    1177

    Default

    okay but only my boss will use that form, he gets info from people and manually input them into that form and from there he sends it to the link given to us from our clients (if that makes sense) so there will only be one person at a time who would use that form.


    ps.

    quick question how do you set the minimum value of an input type="text" field in html, I tried but my methods aren't working
    Last edited by IFS; 10-08-2009 at 03:38 AM.

    Millionaire Campaign:
    Making millionaires out of everyone


    This was unknowingly
    brought to you
    by .Elmer
    and knowingly
    sponsored by Baka Baka!!!



    avi made by my sweet cousin .Elmer


  16. #16
    Copyright © 2013 FS FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD's Avatar
    Gil
    6,638.20
    Gender
    My Mood
    Lonely
    Gifts Fuuko Starfish Ice Cream Bamboo Cup
    Mentioned
    215 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    12-19-2023 07:16 AM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jun 2005
    Location
    I would like to know that too. O_o;;
    Age
    39
    Threads
    162
    Posts
    2,921
    Blog Entries
    5
    AW Wallpapers
    3
    Rep Power
    2200

    Default

    In that case use my first solution.

    As for your other question you can't. The min value for an input element cannot be set. You can use PHP to do the trick though:

    PHP Code:
    // returns the message and stops the script if the length is not above 6 characters
    if( strlen($_POST['firstname']) < )
    {
         echo 
    "Your first name is not long enough. Go tell your government you want a name change. :P";
         die();

    Last edited by FlashD; 10-08-2009 at 07:33 AM.

  17. #17
    4: [Classified brah] Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris has a reputation beyond repute Eris's Avatar
    Gil
    101,951.98
    Gender
    Gifts Tuxedo Mask Rose Mario Question Block Pen
    Mentioned
    301 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    03-06-2015 01:53 AM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Aug 2001
    Location
    Tau Ceti V
    Age
    37
    Threads
    617
    Posts
    19,697
    Blog Entries
    620
    Rep Power
    14769

    Post

    Quote Originally Posted by FlashD View Post
    In that case use my first solution.

    As for your other question you can't. The min value for an input element cannot be set. You can use PHP to do the trick though:

    PHP Code:
    // returns the message and stops the script if the length is not above 6 characters
    if( strlen($_POST['firstname']) < )
    {
         echo 
    "Your first name is not long enough. Go tell your government you want a name change. :P";
         die();

    Of course you can, with javascript. You should still do the above in case the user doesn't have javascript enabled, or uses some weird browser, but on top of that, you can add a javascript that does client-side validation to save server processing power on requests.

    Code:
    <html>
     <head>
      <script language="javascript">
       function validate_form() {
         var name = document.getElementById('name');
    
         // Silently deal with errors:
         if(name == null) return true; // Go on with with submit
    
         // Check name length
         if(name.value.length < 5) { 
            alert("Name must be longer than 5 letters"); 
            return false;  // Do not go on with submit
         }
         else return true; // Go on with submit
       }
      </script>
     </head>
     <body>
      <form id="myform" onSubmit="return validate_form();" method="POST" action="whatever">
        <input type="text" id="name"></input>
        <input type="submit"></input>
      </form>
     </body>
    </html>
    I don't have my good DOM programming book around, but I think that approach should be pretty safe and fail gracefully where it doesn't work.
    Last edited by Eris; 10-08-2009 at 12:23 PM.



    Hey look, Japan made a movie about me!

  18. #18
    boopaloop! IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS's Avatar
    Gil
    25,635.11
    Gender
    My Mood
    Angelic
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    05-12-2012 02:03 PM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jan 2009
    Location
    I live in South Africa, Kempton Park, Birchliegh
    Age
    35
    Threads
    17
    Posts
    1,037
    Rep Power
    1177

    Default

    Thanks for all the help FlashD and Eris, and Miss Moonlight its all greatly appreciated

    Millionaire Campaign:
    Making millionaires out of everyone


    This was unknowingly
    brought to you
    by .Elmer
    and knowingly
    sponsored by Baka Baka!!!



    avi made by my sweet cousin .Elmer


  19. #19
    boopaloop! IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS's Avatar
    Gil
    25,635.11
    Gender
    My Mood
    Angelic
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    05-12-2012 02:03 PM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jan 2009
    Location
    I live in South Africa, Kempton Park, Birchliegh
    Age
    35
    Threads
    17
    Posts
    1,037
    Rep Power
    1177

    Default

    Quote Originally Posted by FlashD View Post
    My code doesn't work as is. I wrote it only as an example. It's missing the function saveToFile() which writes the data into a file.

    The error shown is because of this line
    PHP Code:
     $xml .= "<CustomerData>\n\t<FirstName>$_POST['firstname']</FirstName>\n</CustomerData>"
    It should be:
    PHP Code:
     $xml .= "<CustomerData>\n\t<FirstName>".$_POST['firstname']."</FirstName>\n</CustomerData>"
    Just to see if the XML works use this one:
    PHP Code:
    <?php
    // when you press the submit button this part is processed
    if( $_REQUEST['action'] == "xml" )
    {
         
    // this is where we add the gathered data from the form below
         
    $xml "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
         
    $xml .= "<CustomerData>\n\t<FirstName>${_POST['firstname']}</FirstName>\n</CustomerData>";

         
    // this is a function that will save the content to a normal XML file
         
    print $xml;
         die();
    }

    // this prints the form as you have it on your site (only the first name though)
    print "<html>
    <body>
    <form action=\"
    $PHP_SELF?action=xml\" method=\"post\" enctype=\"multipart/form-data\">
    <input type=\"text\" name=\"firstname\"><p>
    <input type=\"submit\" value=\"Submit\">
    </form>
    </body>
    </html>
    "
    ;
    ?>
    this is really good code, but how would I use it?

    The method I used it in is as a post page, you enter info in the contactform and it gets posted automatically to the xml page, but this give me a new form where I then have to enter in data again, and then it takes me to the xml page, here is a link to see what I mean https://www.ratesdirect.co.za/insura...r/xml-gate.php how do I get the xml file it posts to as a file on my computer or get it to mail the xml page to me?

    Millionaire Campaign:
    Making millionaires out of everyone


    This was unknowingly
    brought to you
    by .Elmer
    and knowingly
    sponsored by Baka Baka!!!



    avi made by my sweet cousin .Elmer


  20. #20
    Copyright © 2013 FS FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD's Avatar
    Gil
    6,638.20
    Gender
    My Mood
    Lonely
    Gifts Fuuko Starfish Ice Cream Bamboo Cup
    Mentioned
    215 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    12-19-2023 07:16 AM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jun 2005
    Location
    I would like to know that too. O_o;;
    Age
    39
    Threads
    162
    Posts
    2,921
    Blog Entries
    5
    AW Wallpapers
    3
    Rep Power
    2200

    Default

    I checked your site and you just redirected your form to mine and this is not what I meant. You have to edit my form to match yours and join them.

    You have to take my script and include it somewhere in your own script and change this part:
    HTML Code:
    <html>
    <body>
    <form action=\"$PHP_SELF?action=xml\" method=\"post\" enctype=\"multipart/form-data\">
    <input type=\"text\" name=\"firstname\"><p>
    <input type=\"submit\" value=\"Submit\">
    </form>
    </body>
    </html>
    in my script with yours. The action attribute in the form element needs to be the same as mine though.

  21. #21
    boopaloop! IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS's Avatar
    Gil
    25,635.11
    Gender
    My Mood
    Angelic
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    05-12-2012 02:03 PM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jan 2009
    Location
    I live in South Africa, Kempton Park, Birchliegh
    Age
    35
    Threads
    17
    Posts
    1,037
    Rep Power
    1177

    Default

    I did change that part, and it didn't give me any display, so I changed it back before I posted the link, because I thought I might have messed something up

    Millionaire Campaign:
    Making millionaires out of everyone


    This was unknowingly
    brought to you
    by .Elmer
    and knowingly
    sponsored by Baka Baka!!!



    avi made by my sweet cousin .Elmer


  22. #22
    Copyright © 2013 FS FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD's Avatar
    Gil
    6,638.20
    Gender
    My Mood
    Lonely
    Gifts Fuuko Starfish Ice Cream Bamboo Cup
    Mentioned
    215 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    12-19-2023 07:16 AM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jun 2005
    Location
    I would like to know that too. O_o;;
    Age
    39
    Threads
    162
    Posts
    2,921
    Blog Entries
    5
    AW Wallpapers
    3
    Rep Power
    2200

    Default

    PM me the PHP file with the form you are using and I'll see if I can help you with it a little more. Like that my hands are pretty much tied.

  23. #23
    boopaloop! IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS's Avatar
    Gil
    25,635.11
    Gender
    My Mood
    Angelic
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    05-12-2012 02:03 PM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jan 2009
    Location
    I live in South Africa, Kempton Park, Birchliegh
    Age
    35
    Threads
    17
    Posts
    1,037
    Rep Power
    1177

    Default

    thanks FlashD much appreciated, just one noob question from my side, how does one upload files to a private message? I tried earlier today but I couldn't find a place where I could do that

    Millionaire Campaign:
    Making millionaires out of everyone


    This was unknowingly
    brought to you
    by .Elmer
    and knowingly
    sponsored by Baka Baka!!!



    avi made by my sweet cousin .Elmer


  24. #24
    Copyright © 2013 FS FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD has a reputation beyond repute FlashD's Avatar
    Gil
    6,638.20
    Gender
    My Mood
    Lonely
    Gifts Fuuko Starfish Ice Cream Bamboo Cup
    Mentioned
    215 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    12-19-2023 07:16 AM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jun 2005
    Location
    I would like to know that too. O_o;;
    Age
    39
    Threads
    162
    Posts
    2,921
    Blog Entries
    5
    AW Wallpapers
    3
    Rep Power
    2200

    Default

    Change the extension of your script from .php to .phps and PM me the link to it. I will look at it only after tomorrow, since I won't be home tomorrow. You can't upload files via PMs, btw.
    Last edited by FlashD; 10-13-2009 at 03:58 PM.

  25. #25
    boopaloop! IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS has a reputation beyond repute IFS's Avatar
    Gil
    25,635.11
    Gender
    My Mood
    Angelic
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    05-12-2012 02:03 PM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Jan 2009
    Location
    I live in South Africa, Kempton Park, Birchliegh
    Age
    35
    Threads
    17
    Posts
    1,037
    Rep Power
    1177

    Default

    I'm sorry this must be getting annoying, but this is what need to be done

    Required Fields:
    -Title
    -Firstname
    -Lastname
    -ID
    -We also need at least 1 contact number.

    Validation:
    -No numeric or special characters to be sent through firstname or lastname.
    -ID must have 13 numeric values no letters or special characters.
    -Contact number must be numeric and not have special characters or spaces.
    - Telephone number. The area code must be 3 digits and number must be 7.
    - Mobile number must be 10 digits.
    -Email must only allow @_.- to be accepted no other special characters.

    XML, replace VALUES as required.
    <?xml version="1.0" encoding="UTF-8"?>
    <lead>
    <mode>TEST</mode> keep as TEST only change if directed
    <title>TITLE</title> Mr, Mrs, Miss, Dr, Prof are the only values we currently accept
    <firstname>FIRSTNAME</firstname>
    <lastname>LASTNAME</lastname>
    <id>ID</id> Will help with validation and reducing duplicate leads
    <homecode>HOMECODE</homecode>
    <hometel>HOMETEL</hometel>
    <workcode>WORKCODE</workcode>
    <worktel>WORKTEL</worktel>
    <mobile>MOBILE</mobile>
    <email>EMAIL</email>
    <comment>COMMENT</comment>
    <source>RATESDIRECT</source> This identifies your source
    <notes></notes> Leave blank
    <language>E</language> E – English (default), A – Afrikaans
    <product>PRODUCT</product> P – Personal (Default), B – Business
    </lead>

    The above XML can then be posted to https://www.outsurance.co.za/OLL/goleadtest.asp a XML response will be then be returned.
    The XML should be posted in a variable called lead and the XML also needs to be URLencoded.

    <?xml version="1.0" encoding="UTF-8"?>
    <response>
    <resultNo><resultNo> -1 if an error occurred. 0 is successful
    <resultMsg></resultMsg> On success returns reference number for the lead generated.
    </response>

    These are the possible returned values for resultMsg


    ^
    is what should happen or whatever. I'm really sorry for asking so much help but I have no idea what the hell I'm suppose to do here

    Millionaire Campaign:
    Making millionaires out of everyone


    This was unknowingly
    brought to you
    by .Elmer
    and knowingly
    sponsored by Baka Baka!!!



    avi made by my sweet cousin .Elmer


Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Posting Permissions

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