/    Sign up×
Community /Pin to ProfileBookmark

Can someone help here? I need a php code that can varify the information of a form and then email me the results.

Thanks

to post a comment
PHP

10 Comments(s)

Copy linkTweet thisAlerts:
@pyroJul 24.2003 — The mail you the information part can be found [URL=http://forums.webdeveloper.com/showthread.php?s=&threadid=9543#post48748]here[/URL]. The validation part is going to depend on how you need it validated.
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJul 24.2003 — Pyro~

What kind of information do you need to know?

Thanks
Copy linkTweet thisAlerts:
@Da_WarriahJul 24.2003 — well what information do you want to be validated?
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJul 24.2003 — First name

Last name

Address

Apartment*

City

Zip

Email

Home phone

Work phone*


  • * = fieds should only show up if info in them

    is it possible to make required fields?

    also is it possible to have a submit button as well as button if they made a mistake to go back and fix it?


  • Thanks
    Copy linkTweet thisAlerts:
    @pyroJul 24.2003 — To validate if there is data in a field, look into the [URL=http://us2.php.net/manual/en/function.empty.php]empty()[/URL] function. You can also use that to only make it show up if they entered values...
    Copy linkTweet thisAlerts:
    @Tasmanian_DevilauthorJul 24.2003 — This is what i had before, but can it be modified to work like I want it to?

    <html>

    <head>

    <title>Please verify your information</title>

    </head>

    <body>

    <?PHP

    echo "Please verify that the following information is correct:<br/><br/>";

    foreach ($_POST as $key => $value) {

    if ($key != "required") {

    $msg .= ucfirst ($key) ." : ". $value . "<br/>";

    }

    }

    foreach ($_
    POST as $key => $value) {

    $emsg .= ucfirst ($key) ." : ". $value . "n";

    }

    echo $msg;

    ?>

    <form action="mailer.php" method="post">

    <input type="hidden" name="formvalues" value="<?PHP echo $emsg; ?>" />

    <input type="submit" value="Yes the information is correct" />

    <input type="button" value="No the information is incorrect." onclick="history.go(-1)"/>

    </form>

    </body>

    </html>
    Copy linkTweet thisAlerts:
    @mikeyzcSep 04.2003 — ive been trying to do the same type of thing. I tried using javascript, but it isn't working correctly or at all. I'm wondering if since it's action points to a different php function if that's the reason the javascript isn't working correctly.
    Copy linkTweet thisAlerts:
    @pyroSep 04.2003 — We're going to need to see some code of what you are trying to do...
    Copy linkTweet thisAlerts:
    @mikeyzcSep 04.2003 — ok..i was reading threads and came upon this code, which i've been trying to make work for me.

    [i]<SCRIPT language="JavaScript">

    <!-- Begin

    function verify() {

    var themessage = "You are required to complete the following fields: ";

    if (document.form1.txt_name.value=="") {

    themessage = themessage + " - Name";

    }

    if (document.form1.txt_address.value=="") {

    themessage = themessage + " - Address";

    }

    if (document.form1.txt_city.value=="") {

    themessage = themessage + " - City";

    }

    if (document.form1.txt_state.value=="") {

    themessage = themessage + " - State";

    }

    if (document.form1.txt_zip.value=="") {

    themessage = themessage + " - Zip";

    }

    if (document.form1.txt_mail.value=="") {

    themessage = themessage + " - Email";

    }

    if (document.form1.fac_name.value=="") {

    themessage = themessage + " - Facility Name";

    }

    if (document.form1.type.value=="") {

    themessage = themessage + " - Facility Type";

    }

    if (document.form1.role.value=="") {

    themessage = themessage + " - Your Role";

    }

    if (document.form1.phys_num.value=="") {

    themessage = themessage + " - Physician Number";

    }

    if (document.form1.time.value=="") {

    themessage = themessage + " - Time frame for purchase";

    }


    //alert if fields are empty and cancel form submit

    if (themessage == "You are required to complete the following fields: ") {

    document.form1.submit();

    }

    else {

    alert(themessage);

    return false;

    }

    }



    // End -->

    </script>



    <form name="form1" method="post" onsubmit="return verify();" action="db_info.php">[/i]


    this code just blows right through and submits
    ×

    Success!

    Help @Tasmanian_Devil spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.4,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,

    tipper: @Samric24,
    tipped: article
    amount: 1000 SATS,
    )...