Tasmanian Devil
07-24-2003, 08:59 AM
Can someone help here? I need a php code that can varify the information of a form and then email me the results.
Thanks
Thanks
|
Click to See Complete Forum and Search --> : PHP nedded τΏτ Tasmanian Devil 07-24-2003, 08:59 AM Can someone help here? I need a php code that can varify the information of a form and then email me the results. Thanks pyro 07-24-2003, 09:05 AM The mail you the information part can be found here (http://forums.webdeveloper.com/showthread.php?s=&threadid=9543#post48748). The validation part is going to depend on how you need it validated. Tasmanian Devil 07-24-2003, 09:15 AM Pyro~ What kind of information do you need to know? Thanks Da Warriah 07-24-2003, 10:31 AM well what information do you want to be validated? Tasmanian Devil 07-24-2003, 12:48 PM First name Last name Address Apartment* City Zip 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 pyro 07-24-2003, 01:17 PM To validate if there is data in a field, look into the empty() (http://us2.php.net/manual/en/function.empty.php) function. You can also use that to only make it show up if they entered values... Tasmanian Devil 07-24-2003, 01:22 PM 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> mikeyzc 09-04-2003, 11:52 AM 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. pyro 09-04-2003, 11:56 AM We're going to need to see some code of what you are trying to do... mikeyzc 09-04-2003, 12:03 PM ok..i was reading threads and came upon this code, which i've been trying to make work for me. <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"> this code just blows right through and submits pyro 09-04-2003, 06:21 PM Try one of these two validation scripts: http://www.infinitypages.com/research/formvalidation.htm http://www.infinitypages.com/research/formvalidation_2.htm webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |