Cerere script formular comanda ( Complex ) !
Last Updated: May 30 2016 17:32, Started by
pcpalex
, May 25 2016 14:50
·
0
#1
Posted 25 May 2016 - 14:50
Buna ziua ,
Cine ma poate ajuta si pe mine cu urmatorul script? Doresc sa fac un script ( pagina html ) in ea sa fie un formular de comanda cu Nume , Prenume , etc. Datele completate din aceasta pagina vreau sa se bage automat intr-un fisier excel sau alt fisier ca nu ma deranjeaza doar ca eu in acel fisier am un contract , formular , etc . Adica : Subsemnatul XXXXX cu domicilul in XXXXX . Adica datele din primul fisier , din formular sa se transfere automat in acel fisier sa completeze automat spatiile din contractul meu . Nu stiu daca am fost destul de explicit , Sper sa ma puteti ajuta cu o informatie , sugestie , script . Multumesc. |
#2
Posted 25 May 2016 - 15:05
Poti face un template in html in care inserezi datele introduse in formular si apoi il trimiti pe e-mail.
|
#3
Posted 25 May 2016 - 15:21
#4
Posted 25 May 2016 - 15:36
Poti folosi FPDF pentru a genera pdf-uri dupa un anumit model. Iar apoi il trimiti pe mail.
http://stackoverflow...-php-using-fpdf |
#6
Posted 25 May 2016 - 16:23
[ https://www.youtube-nocookie.com/embed/Kid6Xrqf9-Y?feature=oembed - Pentru incarcare in pagina (embed) Click aici ]
|
#7
Posted 25 May 2016 - 18:12
Clar nu ati inteles ce doresc eu , sau cel putin o parte.
Avem asa: Quote Contract Prestari Servicii Art.1 Intre Firma mea. inmatriculata la Registul Comertului ddddd, cod fiscal dddddd , cont virment nr. __________________________Deschis la _______ banca, reprezentat prin director general Eu, in calitate de prestator de servicii SI ___________________________________________ , cu sediul in ________________________judetul__________________, forma juridical _____________________, inregistrata la______________ reprezentata prin __________________si prin ________________, in calitate de ________________, s-a incheiat prezentul contract economic. In locul acelor linii cu rosu , eu vreau sa se bage cuvintele din acel formular pe care il completez eu la inceput . Adica sa se completeze automat o foaie de acest gen pe baza formulrului pe care il completez iar apoi sa ii dau printare. Edited by pcpalex, 25 May 2016 - 18:13. |
#8
Posted 26 May 2016 - 07:34
tigerheart, on 25 mai 2016 - 15:05, said:
Poti face un template in html in care inserezi datele introduse in formular .... Textul Quote Contract Prestari Servicii Art.1 Intre Firma mea. inmatriculata la Registul Comertului ddddd, cod fiscal dddddd , cont virment nr. Sau poti sa 'aduci' textul prin ajax in sectiunile prestabilite din formular si apoi sa 'versi' tot continutul intr-un fisier. Edited by robbie_ro, 26 May 2016 - 07:36. |
#9
Posted 26 May 2016 - 08:29
robbie_ro, on 26 mai 2016 - 07:34, said:
Textul il tii ascuns in formular, completezi cu datele introduse, apoi tot textul (cel ascuns si cel completat) il trimiti catre un fisier. Sau poti sa 'aduci' textul prin ajax in sectiunile prestabilite din formular si apoi sa 'versi' tot continutul intr-un fisier. Nu stiu sa fac asta... Stiu ca acest lucru se poate face si printr`un fisier excel ..Nu stiu cum sa caut mai exact pe net ca pe urma sa urmez pasi respectivi.. Edited by pcpalex, 26 May 2016 - 08:30. |
#10
Posted 26 May 2016 - 09:27
Prima data invata sa trimiti continutul unui formular intr-un fisier. Apoi, cu putina imaginatie, vei reusi si ceea ce ti-am scris mai sus.
|
|
#11
Posted 26 May 2016 - 10:57
Deci tu vei completa datele respective? Nu clientul direct intr-o pagina?
Daca le introduci tu, de ce vrei sa te complici neaparat cu o pagina html cand poti avea o mica aplicatie in care sa ai formularul respectiv si cand apesi pe buton "Genereaza contract" sa iti faca acel PDF cu toate datele completate? |
#12
Posted 26 May 2016 - 10:59
pcpalex, macar ai incercat sa vezi cum ar merge solutia cu pdf-ul?
Asta ca sa nu mai zic de prima solutie propusa: faci un template frumusel in html cu structura dorita, vizitatorul completeaza formularul pe site si cand il trimite atunci datele sunt introduse in template si apoi acesta e trimis pe mail-ul tau. Intri cu Chrome pe mail, selectezi doar partea cu template-ul din mail, dai Print si il salvezi in pdf... greu, nu? |
#13
Posted 26 May 2016 - 11:35
tigerheart, on 26 mai 2016 - 10:59, said:
pcpalex, macar ai incercat sa vezi cum ar merge solutia cu pdf-ul? Asta ca sa nu mai zic de prima solutie propusa: faci un template frumusel in html cu structura dorita, vizitatorul completeaza formularul pe site si cand il trimite atunci datele sunt introduse in template si apoi acesta e trimis pe mail-ul tau. Intri cu Chrome pe mail, selectezi doar partea cu template-ul din mail, dai Print si il salvezi in pdf... greu, nu? Am spus clar fara EMAIL ! Nu vreau sa folosesc email-ul ... robbie_ro, on 26 mai 2016 - 09:27, said:
Prima data invata sa trimiti continutul unui formular intr-un fisier. Apoi, cu putina imaginatie, vei reusi si ceea ce ti-am scris mai sus. Am rezolvat 90% , dar cum pot face ca datele din formular sa le trimit catre 2 fisiere ? Adica am asa in fisierul de trimitere : $file = "home.html"; Pentru 1 fisier , ca datele sa se trimita la 2 fisiere cum fac ? |
#14
Posted 26 May 2016 - 12:32
Cel mai simplu este
$file1 = "1.txt"; $file2 = "2.txt"; Si trimiti prima data catre $file1, apoi catre $file2. Edited by robbie_ro, 26 May 2016 - 12:33. |
#15
Posted 26 May 2016 - 13:09
robbie_ro, on 26 mai 2016 - 12:32, said:
Cel mai simplu este $file1 = "1.txt"; $file2 = "2.txt"; Si trimiti prima data catre $file1, apoi catre $file2. Am priceput ideea , dar cum pot face ca din fisierul trimitere.php sa trimit datele catre fisierul1 si in acelas timp sa trimit alte date catre fisierul2. Nu vreau sa fac 2 fisiere pentru trimitere ...Vreau din fisierul trimitere.php sa trimit la 2 pagini diferite , 2 continutiri diferite ..? Fisierul meu arata asa , unde trebuie sa modific sa adaug un continut nou sa se trimita catre al 2 fisier. <?php // Scrie data si ora in fisierul cu dedicatii. $file = "Home.html"; $data = ''; if (file_exists($file)) { $data = file_get_contents($file); } if (strpos($data, '<table') === false) { $data = '<table border="1" width="100%">'; $data .= '<tr>'; $data .= '<th>Nume</th>'; $data .= '<th>Prenume</th>'; $data .= '<th>Localitate</th>'; $data .= '<th>Adresa</th>'; $data .= '<th>Telefon</th>'; $data .= '</tr>'; } $data = str_replace('</table>', ' ', $data); $data .= '<tr style="border: solid 1px black">'; // Get the data from the 'Nume' field of the form. $data .= '<td>' . htmlentities($_POST['Nume']) . '</td>'; // Get the data from the 'Prenume' field of the form. $data .= '<td>' . htmlentities($_POST['Prenume']) . '</td>'; // Get the data from the 'localitate' field of the form. $data .= '<td>' . htmlentities($_POST['Localitate']) . '</td>'; // Get the data from the 'Adresa' field of the form. $data .= '<td>' . htmlentities($_POST['Adresa']) . '</td>'; // Get the data from the 'Telefon' field of the form. $data .= '<td>' . htmlentities($_POST['Telefon']) . '</td>'; // Get the data from the 'mesaj' field of the form. $data .= '<td>' . htmlentities($_POST["mesaj"]) . '</td>'; $data .= '</tr>'; $data .= '</table>'; // $email is detecting if the 'dela' field is empty. $name = htmlentities($_POST['Nume']); // $message is detecting if $spam words are in the 'mesaj' field. $message = htmlentities($_POST['mesaj']); // Specifications of the "bad words", spam, in the 'mesaj' field. $spam = "/(test)/i"; if (empty($name)) { echo ('<br /><br /><center><body bgcolor="#000000" background="bgsite.gif"><div style="font-family:verdana,arial,san-serif;font-size:16px;color:black;border:5px groove #cc0000;width:320px;padding:5px;background:#ffffff;"><b>Ai uitat sa-ti completezi numele!!<br />Intoarce-te inapoi si completeaza!!</b></div></center>'); } else { // Detects the $spam word and displays it in the warning. if(preg_match($spam,$message,$matches)) { echo ('<br /><br /><center><body bgcolor="#000000" background="bgsite.gif"><div style="font-family:verdana,arial,san-serif;font-size:16px;color:black;border:5px groove #cc0000;width:300px;padding:5px;background:#ffffff;"><b>Nu sunt admise cuvinte jignitoare.<br />Intoarce-te inapoi si modifica!!</b></div></center>'); } elseif(preg_match($spam,$name,$matches)) { echo ('<br /><br /><center><body bgcolor="#000000" background="bgsite.gif"><div style="font-family:verdana,arial,san-serif;font-size:16px;color:black;border:5px groove #cc0000;width:300px;padding:5px;background:#ffffff;"><b>Nu sunt admise cuvinte jignitoare.<br />Intoarce-te inapoi si modifica!!</b></div></center>'); } else { // The file to write $data to (don't forget to CHMOD it to 777 or rwx-rwx-rwx). if (!$file_handle = fopen($file, "w+")) { echo "Nu pot deschide fisierul."; } if (!fwrite($file_handle, $data)) { echo "Nu pot scrie in fisier."; } fclose($file_handle); echo ('<br /><br /><center><body bgcolor="#000000" background="bgsite.gif"><div style="font-family:verdana,arial,san-serif;font-size:16px;color:black;border:5px groove #00cc00;width:300px;padding:5px;background:#ffffff;"><b><br />Multumim!</b></div></center>'); echo ('<meta http-equiv="Refresh" content="4;url=home2.php" />'); } } ?> Edited by pcpalex, 26 May 2016 - 13:12. |
|
#16
Posted 26 May 2016 - 14:46
<?php // Scrie data si ora in fisierul cu dedicatii. $file1 = "Home.html"; $file2 = "HaHa.html"; // $email is detecting if the 'dela' field is empty. $name = htmlentities($_POST['Nume']); // $message is detecting if $spam words are in the 'mesaj' field. $message = htmlentities($_POST['mesaj']); // Specifications of the "bad words", spam, in the 'mesaj' field. $spam = "/(test)/i"; if (empty($name)) { echo ('<br /><br /><center><body bgcolor="#000000" background="bgsite.gif"><div style="font-family:verdana,arial,san-serif;font-size:16px;color:black;border:5px groove #cc0000;width:320px;padding:5px;background:#ffffff;"><b>Ai uitat sa-ti completezi numele!!<br />Intoarce-te inapoi si completeaza!!</b></div></center>'); } else { // Detects the $spam word and displays it in the warning. if(preg_match($spam,$message,$matches)) { echo ('<br /><br /><center><body bgcolor="#000000" background="bgsite.gif"><div style="font-family:verdana,arial,san-serif;font-size:16px;color:black;border:5px groove #cc0000;width:300px;padding:5px;background:#ffffff;"><b>Nu sunt admise cuvinte jignitoare.<br />Intoarce-te inapoi si modifica!!</b></div></center>'); } elseif(preg_match($spam,$name,$matches)) { echo ('<br /><br /><center><body bgcolor="#000000" background="bgsite.gif"><div style="font-family:verdana,arial,san-serif;font-size:16px;color:black;border:5px groove #cc0000;width:300px;padding:5px;background:#ffffff;"><b>Nu sunt admise cuvinte jignitoare.<br />Intoarce-te inapoi si modifica!!</b></div></center>'); } else { echo write_file($file1, $_POST['Nume'], $_POST['Prenume'], $_POST['Localitate'], $_POST['Adresa'], $_POST['Telefon'], $_POST["mesaj"]); echo write_file($file2, $_POST['Nume'], $_POST['Prenume'], $_POST['Localitate'], $_POST['Adresa'], $_POST['Telefon'], $_POST["mesaj"]); echo ('<br /><br /><center><body bgcolor="#000000" background="bgsite.gif"><div style="font-family:verdana,arial,san-serif;font-size:16px;color:black;border:5px groove #00cc00;width:300px;padding:5px;background:#ffffff;"><b><br />Multumim!</b></div></center>'); echo ('<meta http-equiv="Refresh" content="4;url=home2.php" />'); } } function write_file($file_name, $nume, $prenume, $localitate, $adresa, $telefon, $mesaj){ $data=''; if (strlen(trim($file_name))>0){ if (file_exists($file_name)) { $data = file_get_contents($file_name); } if (strpos($data, '<table') === false) { $data = '<table border="1" width="100%">'; $data .= '<tr>'; $data .= '<th>Nume</th>'; $data .= '<th>Prenume</th>'; $data .= '<th>Localitate</th>'; $data .= '<th>Adresa</th>'; $data .= '<th>Telefon</th>'; $data .= '</tr>'; } $data = str_replace('</table>', ' ', $data); $data .= '<tr style="border: solid 1px black">'; // Get the data from the 'Nume' field of the form. $data .= '<td>' . htmlentities($nume) . '</td>'; // Get the data from the 'Prenume' field of the form. $data .= '<td>' . htmlentities($prenume) . '</td>'; // Get the data from the 'localitate' field of the form. $data .= '<td>' . htmlentities($localitate) . '</td>'; // Get the data from the 'Adresa' field of the form. $data .= '<td>' . htmlentities($adresa) . '</td>'; // Get the data from the 'Telefon' field of the form. $data .= '<td>' . htmlentities($telefon) . '</td>'; // Get the data from the 'mesaj' field of the form. $data .= '<td>' . htmlentities($mesaj) . '</td>'; $data .= '</tr>'; $data .= '</table>'; if (!$file_handle = fopen($file_name, "w+")) return "Nu pot deschide fisierul ".$file_name; if (!fwrite($file_handle, $data)) return "Nu pot scrie in fisierul ".$file_name; if(fclose($file_handle)) return "Fisier creat ".$file_name; } else { return "Nume fisier invalid ".$file_name; } } ?> Daca vrei sa trimiti continut diferit in cele doua fisiere, atunci ori mai definesti o functie similara wrtie_file2() in care stabilesti alt continut (eventual si alte argumente), ori scoti continutul ($data) din functia creata de mine si ai argumentele $file_name si $continut: <?php // Scrie data si ora in fisierul cu dedicatii. $file1 = "Home.html"; $file2 = "HaHa.html"; $data = ''; if (file_exists($file1)) { $data = file_get_contents($file1); } if (strpos($data, '<table') === false) { $data = '<table border="1" width="100%">'; $data .= '<tr>'; $data .= '<th>Nume</th>'; $data .= '<th>Prenume</th>'; $data .= '<th>Localitate</th>'; $data .= '<th>Adresa</th>'; $data .= '<th>Telefon</th>'; $data .= '</tr>'; } $data = str_replace('</table>', ' ', $data); $data .= '<tr style="border: solid 1px black">'; // Get the data from the 'Nume' field of the form. $data .= '<td>' . htmlentities($_POST['Nume']) . '</td>'; // Get the data from the 'Prenume' field of the form. $data .= '<td>' . htmlentities($_POST['Prenume']) . '</td>'; // Get the data from the 'localitate' field of the form. $data .= '<td>' . htmlentities($_POST['Localitate']) . '</td>'; // Get the data from the 'Adresa' field of the form. $data .= '<td>' . htmlentities($_POST['Adresa']) . '</td>'; // Get the data from the 'Telefon' field of the form. $data .= '<td>' . htmlentities($_POST['Telefon']) . '</td>'; // Get the data from the 'mesaj' field of the form. $data .= '<td>' . htmlentities($_POST["mesaj"]) . '</td>'; $data .= '</tr>'; $data .= '</table>'; // $email is detecting if the 'dela' field is empty. $name = htmlentities($_POST['Nume']); // $message is detecting if $spam words are in the 'mesaj' field. $message = htmlentities($_POST['mesaj']); // Specifications of the "bad words", spam, in the 'mesaj' field. $spam = "/(test)/i"; $continut_HaHa_html = 'bla-bla-bla'; if (empty($name)) { echo ('<br /><br /><center><body bgcolor="#000000" background="bgsite.gif"><div style="font-family:verdana,arial,san-serif;font-size:16px;color:black;border:5px groove #cc0000;width:320px;padding:5px;background:#ffffff;"><b>Ai uitat sa-ti completezi numele!!<br />Intoarce-te inapoi si completeaza!!</b></div></center>'); } else { // Detects the $spam word and displays it in the warning. if(preg_match($spam,$message,$matches)) { echo ('<br /><br /><center><body bgcolor="#000000" background="bgsite.gif"><div style="font-family:verdana,arial,san-serif;font-size:16px;color:black;border:5px groove #cc0000;width:300px;padding:5px;background:#ffffff;"><b>Nu sunt admise cuvinte jignitoare.<br />Intoarce-te inapoi si modifica!!</b></div></center>'); } elseif(preg_match($spam,$name,$matches)) { echo ('<br /><br /><center><body bgcolor="#000000" background="bgsite.gif"><div style="font-family:verdana,arial,san-serif;font-size:16px;color:black;border:5px groove #cc0000;width:300px;padding:5px;background:#ffffff;"><b>Nu sunt admise cuvinte jignitoare.<br />Intoarce-te inapoi si modifica!!</b></div></center>'); } else { echo write_file($file1, $data); echo write_file($file2, $continut_HaHa_html); echo ('<br /><br /><center><body bgcolor="#000000" background="bgsite.gif"><div style="font-family:verdana,arial,san-serif;font-size:16px;color:black;border:5px groove #00cc00;width:300px;padding:5px;background:#ffffff;"><b><br />Multumim!</b></div></center>'); echo ('<meta http-equiv="Refresh" content="4;url=home2.php" />'); } } function write_file($file_name, $continut){ if (strlen(trim($file_name))>0 && strlen(trim($continut))>0){ if (!$file_handle = fopen($file_name, "w+")) return "Nu pot deschide fisierul ".$file_name; if (!fwrite($file_handle, $continut)) return "Nu pot scrie in fisierul ".$file_name; if(fclose($file_handle)) return "Fisier creat ".$file_name; } else { return "Nume fisier invalid sau lipsa date de scris in fisier."; } } ?> Codul l-am facut in graba, sper sa nu fi scapat erori. Dar cred ca intelegi ce am vrut sa iti exemplific. Edited by robbie_ro, 26 May 2016 - 15:02. |
#18
Posted 30 May 2016 - 09:11
Multumesc mult , Am rezolvat .
Acum am nevoie de de o alta "compunere" Am fisierul HTMl care se leaga la cel PHP cum este mai sus . Am nevoie sa calculeze niste preturi ascunse. Un exemplu aici : http://instalatiisan...ulator-ariston/ , sper sa nu se considere reclama ... Doar ca eu vreau sa il fac mai complex , cu mai multe campuri si date , si la final toate preturile se aduna intre ele si iti calculeaza pretul final de la toate . |
Anunturi
Bun venit pe Forumul Softpedia!
▶ 0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users