Annonceindlæg fra Infor
15. februar 2008 - 15:55
#7
Prøv den her: ------------------- <? $database = "DIN-DATABASE"; mysql_connect('localhost','NAVN','PASSWORD'); mysql_SELECT_DB($database); if(isset($_POST['submit'])) { $name = str_replace("'", "", $_POST['name']); $virksomhed = str_replace("'", "", $_POST['virksomhed']); $adresse = str_replace("'", "", $_POST['adresse']); $postnr = str_replace("'", "", $_POST['postnr']); $by = str_replace("'", "", $_POST['by']); $tlf = str_replace("'", "", $_POST['tlf']); $mail = str_replace("'", "", $_POST['mail']); $kommentar = str_replace("'", "", $_POST['kommentar']); $pr_mail = str_replace("'", "", $_POST['pr_mail']); $pr_post = str_replace("'", "", $_POST['pr_post']); mysql_query("INSERT INTO mail (navn,virksomhed,adresse,postnr,by,tlf,mail,kommentar,pr_mail,pr_post) VALUES('$navn', '$virksomhed', '$adresse', '$postnr', '$by', '$tlf', '$mail', '$kommentar', '$pr_mail', '$pr_post')"); $tables = mysql_list_tables('$database'); while(list($table) = mysql_fetch_row($tables)) { $array[] = $table; } if(in_array('mail', $array)) { mysql_query("INSERT INTO mail (navn,virksomhed,adresse,postnr,by,tlf,mail,kommentar,pr_mail,pr_post) VALUES('$navn', '$virksomhed', '$adresse', '$postnr', '$by', '$tlf', '$mail', '$kommentar', '$pr_mail', '$pr_post')"); echo "<script>alert('Din mail er gemt!');</script>"; } else { mysql_query(" CREATE TABLE mail ( id INT NOT NULL AUTO_INCREMENT , navn VARCHAR( 100 ) NOT NULL, virksomhed VARCHAR( 100 ) NOT NULL, adresse VARCHAR( 100 ) NOT NULL, postnr VARCHAR( 100 ) NOT NULL, by VARCHAR( 100 ) NOT NULL, tlf VARCHAR( 100 ) NOT NULL, mail VARCHAR( 100 ) NOT NULL, kommentar text NOT NULL, pr_mail VARCHAR( 100 ) NOT NULL, pr_post VARCHAR( 100 ) NOT NULL, PRIMARY KEY (id) ); "); mysql_query("INSERT INTO mail (navn,virksomhed,adresse,postnr,by,tlf,mail,kommentar,pr_mail,pr_post) VALUES('$navn', '$virksomhed', '$adresse', '$postnr', '$by', '$tlf', '$mail', '$kommentar', '$pr_mail', '$pr_post')"); echo "<script>alert('Din mail er gemt!');</script>"; } } ?> <form id="kontaktForm" method="post" action="e_rekvirer_materiale_sendt.php" onSubmit="validering();return false;"> <p> </p> <p> </p> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td width="50" height="25" valign="top">Navn:</td> <td width="25"> </td> <td valign="top"><span id="sprytextfield1"> <label> <input type="text" name="name" id="name" /> </label> <span class="textfieldRequiredMsg">Navn er krævet</span><span class="textfieldMinCharsMsg">Forkert udfyldt.</span><span class="textfieldMaxCharsMsg">Forkert udfyldt.</span></span></td> </tr> <tr> <td width="50" height="25" valign="top">Virksomhed:</td> <td width="25"> </td> <td valign="top"><span id="sprytextfield2"> <label> <input type="text" name="virksomhed" id="virksomhed" /> </label> <span class="textfieldMinCharsMsg">Forkert udfyldt.</span><span class="textfieldMaxCharsMsg">Forkert udfyldt.</span></span></td> </tr> <tr> <td width="50" height="25" valign="top">Adresse</td> <td width="25"> </td> <td valign="top"><span id="sprytextfield3"> <label> <input type="text" name="adresse" id="adresse" /> </label> <span class="textfieldRequiredMsg">Adresse er krævet</span><span class="textfieldMinCharsMsg">Forkert udfyldt.</span><span class="textfieldMaxCharsMsg">Forkert udfyldt.</span></span></td> </tr> <tr> <td width="50" height="25" valign="top">Post nr:</td> <td width="25"> </td> <td valign="top"><span id="sprytextfield4"> <label> <input name="postnr" type="text" id="postnr" size="10" maxlength="4" /> </label> <span class="textfieldRequiredMsg">Postnummer er krævet.</span><span class="textfieldInvalidFormatMsg">Forkert udfyldt.</span><span class="textfieldMinCharsMsg">Forkert udfyldtt.</span><span class="textfieldMaxCharsMsg">For mange tal.</span></span></td> </tr> <tr> <td width="50" height="25" valign="top">By:</td> <td width="25"> </td> <td valign="top"><span id="sprytextfield5"> <label> <input type="text" name="by" id="by" /> </label> <span class="textfieldRequiredMsg">By er krævet.</span><span class="textfieldMinCharsMsg">Der er for få bogstaver.</span><span class="textfieldMaxCharsMsg">For mange bogstaver.</span></span></td> </tr> <tr> <td width="50" height="25" valign="top">Tlf:</td> <td width="25"> </td> <td valign="top"><span id="sprytextfield6"> <label> <input type="text" name="tlf" id="tlf" /> </label> <span class="textfieldRequiredMsg">Telefonnummer er krævet.</span><span class="textfieldInvalidFormatMsg">Forkert format.</span><span class="textfieldMinCharsMsg">For mange tal.</span></span></td> </tr> <tr> <td width="50" height="25" valign="top">Mail:</td> <td width="25"> </td> <td valign="top"><span id="sprytextfield7"> <label> <input type="text" name="mail" id="mail" /> </label> <span class="textfieldRequiredMsg">Mail adresse er krævet.</span><span class="textfieldInvalidFormatMsg">Forkert format.</span></span></td> </tr> <tr> <td width="50" height="25" valign="top">Kommentar:</td> <td width="25"> </td> <td valign="top"><span id="sprytextfield8"> <label></label> <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span><span id="sprytextarea1"> <label> <textarea name="kommentar" id="kommentar" cols="45" rows="5"></textarea> </label> </span></span></td> </tr> <tr> <td height="25" valign="top"> </td> <td> </td> <td height="30" valign="bottom"><label> <input type="checkbox" name="pr_email" id="pr_email" /> </label> Send materiale til min email adresse.</td> </tr> <tr> <td height="25" valign="top"> </td> <td> </td> <td valign="top"><label> <input type="checkbox" name="pr_post" id="pr_post" /> </label> Send materiale til min post adresse.</td> </tr> <tr> <td height="25" valign="top"> </td> <td> </td> <td height="40" valign="bottom"><label> <input type="reset" name="clear" id="clear" value="Ryd alt" /> <input type="submit" name="submit" id="submit" value="Send" /> </label></td> </tr> </table> </form>