Jump to content

Enable/Disable form sections Oo?


rootKID

Recommended Posts

Hi W3S!

 

So my customer at rightmatch.dk want's me to make this formular of a sort, since this is a "Recruiting" company.

Anyways the idea was whenever he finds a "Candidate" to give this new formular to, he could from behind in the ACP (Administrative Controle Panel) control to make a new form link to the user to follow.

Now whenever the user is using the form there has to be 2 options:

 

1: Save

2: End

 

Save mode will make a simple query with the changes to the database.

End will make a query to the database, again an update, except this time it will be adding a tag to the formular inside the database called "Closed"...

 

it is working so far, or so i think, i am at the testing phase and could use some help if possible?

 

What i am struggling with right now is the "Enable/Disable" parts of a formular whenever a new candidate is being created.

 

Now i'm now sure, but the main idea is to make radio buttons on the same page where the new candidate formular is being made.

However not sure how to do this the easiest way?

 

Any ideas if possible?

 

This is my code for the "New Candidate Formular" page:

<?php// Data Skema -> Add New Data Skema Item// =======================================if ( !defined("dataskema") ){	die("Error on loading!");}else{	echo "<form method='post' action='dataskema.php?dataskema_action=add_data'>";				echo "<div>";			echo "Dato Oprettet: ";			echo "<u>".date("d / m - Y")."</u>";		echo "</div>";				echo "<br />";				// Appropriate way to insert data is to fill out EVERY aspect of the datetime-stamp!		echo " <input type='hidden' name='date' value='".date("Y-m-d H:i:s")."' style='width: 100%;' />";				echo "<input type='text' name='firstname' placeholder='Kandidatens Fornavn' style='width: 100%;' />";		echo "<input type='text' name='lastname' placeholder='Kandidatens Efternavn' style='width: 100%;' />";		echo "<input type='text' name='middlename' placeholder='Kandidatens Mellemnavn (Valgfrit)' style='width: 100%;' />";		echo "<input type='text' name='virksomhed_one' placeholder='Kandidatens Virksomhed' style='width: 100%;' />";		echo "Hvis du har flere kandidater på samme tid kan du tilføje deres navne herunder!";		echo "<input type='text' name='virksomhed_two' placeholder='Kandidatens Virksomhed (Valgfrit)' style='width: 100%;' />";		echo "<input type='text' name='virksomhed_three' placeholder='Kandidatens Virksomhed (Valgfrit)' style='width: 100%;' />";		echo "<input type='text' name='virksomhed_four' placeholder='Kandidatens Virksomhed (Valgfrit)' style='width: 100%;' />";				echo "<input type='submit' name='submit' id='submit' value='Tilføj Nyt Skema' />";				echo "<p>";			echo "OBS! Når du har oprettet det nye dataskema til Kandidaten vil linket til kandidaten fremgå ved data skemaernes forside!";		echo "</p>";			echo "</form>";}?>

And yes, some of it is in Danish language, it's a Danish company x)

 

In anyways the main idea is to put the radio button list right before the end of the form (echo "</form>";).

 

And if you wonder why i am asking for the "easiest" way, then this is the list of items IN the formular:

// Navn* fornavn                                -> INPUT (TEXT)  mellemnavn                             -> INPUT (TEXT)* efternavn                              -> INPUT (TEXT)// Adresse og Kontaktoplysninger* info_gadenavn                          -> INPUT (TEXT)* info_nr                                -> INPUT (TEXT)  info_etage                             -> INPUT (TEXT / TAL!)  info_side                              -> SELECT (TAL SOM VÆRDI!)* info_postnr                            -> INPUT (TEXT / TAL!)* info_by                                -> INPUT (TEXT)  info_land                              -> INPUT (TEXT)* info_email                             -> INPUT (TEXT)  info_telefon                           -> INPUT (TEXT / TAL!)* info_mobil                             -> INPUT (TEXT / TAL!)// Fødselsdato* foedsel_dato                           -> INPUT (DATE)// Nuværende Stilling* stilling_titel                         -> INPUT (TEXT)  stilling_virksomhed                    -> INPUT (TEXT)  stilling_job                           -> SELECT (TAL SOM VÆRDI!)// Civiltilstand* civil_tilstand                         -> SELECT (TAL SOM VÆRDI!)  civil_drengehjemme                     -> INPUT (TEXT)  civil_drengesalder                     -> INPUT (TEXT / TAL MED DECIMAL!)  civil_pigerhjemme                      -> INPUT (TEXT)  civil_pigersalder                      -> INPUT (TEXT / TAL MED DECIMAL!)  civil_hvordan                          -> SELECT (TAL SOM VÆRDI!)// Kundens Billede* billede                                -> INPUT (FILE)// Beskrivelse af en selv  beskriv_dig_selv                       -> TEXTAREA// Nøgleord* noegleord_et                           -> INPUT (TEXT)* noegleord_to                           -> INPUT (TEXT)* noegleord_tre                          -> INPUT (TEXT)* noegleord_fire                         -> INPUT (TEXT)* noegleord_fem                          -> INPUT (TEXT)// Egen Karakterisering* karakterisering                        -> TEXTAREA// Tilføjelser* tilfoejelser                           -> TEXTAREA// 1) Styrke* styrke                                 -> TEXTAREA// 2) Største Succes* stoerste_success                       -> TEXTAREA// Svaghed* svaghed                                -> TEXTAREA// Under Pres* under_pres                             -> TEXTAREA// Konfliktsituation Takling* konflikt_takling                       -> TEXTAREA// Motiv* motiv                                  -> TEXTAREA// Karriere Ønsker* karriere_oensker                       -> TEXTAREA// Ryger* ryger                                  -> SELECT (TAL SOM VÆRDI!)// Sygdomme  sygdomme                               -> TEXTAREA// Opsigelsesvarsel* varsel_antal_mdr                       -> INPUT (TEXT / TAL!)* varsel_saerligt_mdr                    -> INPUT (TEXT / TAL!)* klausuler                              -> TEXTAREA// Gageforventninger* gage_oenskede_maaneds_loen             -> INPUT (TEXT / TAL!)* gage_smaertegraense                    -> INPUT (TEXT / TAL!)* gage_nuvaerende_maaneds_loen           -> INPUT (TEXT / TAL!)* gage_pension_valuta                    -> INPUT (TEXT / TAL!)* gage_bonus_spoergsmaal                 -> SELECT (TAL SOM VÆRDI!)* gage_bonus_valuta                      -> INPUT (TEXT / TAL eller PROCENT!)* gage_pcadsl                            -> SELECT (TAL SOM VÆRDI!)* gage_bil                               -> SELECT (TAL SOM VÆRDI!)* gage_telefon                           -> SELECT (TAL SOM VÆRDI!)* gage_mobil                             -> SELECT (TAL SOM VÆRDI!)* gage_andet                             -> TEXTAREA// Eksamensbeviser o.a* eksamen_ja_nej                         -> SELECT (TAL SOM VÆRDI!)* eksamen_forklaring                     -> TEXTAREA// Lønnet Beskæftigelse  anden_beskaeftigelses_loen                   -> TEXTAREA// Referencer  ref_one                                -> INPUT (TEXT)  ref_one_navn                           -> INPUT (TEXT)  ref_one_titel                          -> INPUT (TEXT)  ref_one_virksomhed                     -> INPUT (TEXT)  ref_one_relation                       -> INPUT (TEXT)  ref_one_tlf                            -> INPUT (TEXT / TAL!)  ref_one_mobil                          -> INPUT (TEXT / TAL!)  ref_one_mail                           -> INPUT (TEXT / TAL!)  ref_two                                -> INPUT (TEXT)  ref_two_navn                           -> INPUT (TEXT)  ref_two_titel                          -> INPUT (TEXT)  ref_two_virksomhed                     -> INPUT (TEXT)  ref_two_relation                       -> INPUT (TEXT)  ref_two_tlf                            -> INPUT (TEXT / TAL!)  ref_two_mobil                          -> INPUT (TEXT / TAL!)  ref_two_mail                           -> INPUT (TEXT / TAL!)  ref_three                              -> INPUT (TEXT)  ref_three_navn                         -> INPUT (TEXT)  ref_three_titel                        -> INPUT (TEXT)  ref_three_virksomhed                   -> INPUT (TEXT)  ref_three_relation                     -> INPUT (TEXT)  ref_three_tlf                          -> INPUT (TEXT / TAL!)  ref_three_mobil                        -> INPUT (TEXT / TAL!)  ref_three_mail                         -> INPUT (TEXT / TAL!)// Relevant Om Dig  relevant                               -> TEXTAREA// Fritid  fritid                                 -> TEXTAREA// Jobsøgende, Jobsamtale, Har været til jobsamtale?  jobsoende_ja_nej                       -> SELECT (TAL SOM VÆRDI!)  jobsamtale_ja_nej                      -> SELECT (TAL SOM VÆRDI!)  jobsamtale_virksomhed                  -> INPUT (TEXT)  jobsamtale_dato                        -> INPUT (DATE)  jobsamtale_vaeret_ja_nej               -> SELECT (TAL SOM VÆRDI!)  jobsamtale_vaeret_virksomhed           -> INPUT (TEXT)  jobsamtale_vaeret_dato                 -> INPUT (DATE)

so as you see, it's a LONG list of different values.

 

In some cases i have numbers (tal) as value, text, dates, ###### even a picture i want to upload later on when everything is ready.

 

So in case i didn't lose you just yet, this is my main question:

 

How and What is the easiest way to aproach this "Enable / Disable" form parts?

If you need a more detailed explanation, do tell, i am more than willing to give one if needed!

 

Just hope you can give me some sort of suggestion, would hate to struggle with this one alone (rofl) :D

 

Mr H ;)

Link to comment
Share on other sites

Actually no, i know how to put the radio button on... what i'm asking is if there's another & better way?

 

My plans are to make a seperate table in the database called "candidate_form_settings" or something similar, and via there make some sort of "INT" system... not sure yet, but what i basically need is later on when i make the form, i have to make "if" statements of each individual form items, for instance if the number is 1 etc, then show this part of the form, else show nothing...

 

The main idea is that the customer of my can controle which parts inside the formular he is giving to the candidate so he/she can get the right items showed instead of... well... the whole form, i mean, take a look at the list... not a form i would be having fun with filling out...

 

So i'm asking if there is an easy way to make this "enable/disable" system etc? If you had any idea? Would help alot.. right now i have an idea about the radio "Enable / Disable" system...

 

Now we are at the radio system, whenever i submit a form, this is my code right now:

<?php// Data Skema -> Add New Data Skema Item// =======================================if ( !defined("dataskema") ){	die("Error on loading!");}else{	if( isset($_POST) && !empty($_POST) )	{		if( isset($_POST['submit']) )		{			// Setup			$firstname = $_POST['firstname'];			$lastname = $_POST['lastname'];			$middlename = $_POST['middlename'];			$virksomhed_one = $_POST['virksomhed_one'];			$virksomhed_two = $_POST['virksomhed_two'];			$virksomhed_three = $_POST['virksomhed_three'];			$virksomhed_four = $_POST['virksomhed_four'];			$date = $_POST['date'];						// -----------------------------------			$secret = mksecret();			$unique = make_unique($secret, md5("RightMatch1!MakesYourDreamTrue1!"));			$dsg_saved_secret_id = 0 + $unique;			$dsg_id_runner = 0 + microtime(true);			$ds_FK_dsg_id_runner = 0 + microtime(true);			// -----------------------------------						// Dataskema (DS) Query			$query_ds = "			INSERT INTO			dataskema			(				ds_fornavn,				ds_efternavn,				ds_mellemnavn,				ds_company_one,				ds_company_two,				ds_company_three,				ds_company_four,				ds_dato,				ds_FK_dsg_id_runner			)			VALUES			(				'$firstname',				'$lastname',				'$middlename',				'$virksomhed_one',				'$virksomhed_two',				'$virksomhed_three',				'$virksomhed_four',				'$date',				'$ds_FK_dsg_id_runner'			)";						$mysqli->query($query_ds);						// Dataskema Generator (DSG) Query			$query_dsg = "			INSERT INTO			dataskema_generator			(				dsg_id_runner,				dsg_saved_secret_id			)			VALUES			(				'$dsg_id_runner',				'$dsg_saved_secret_id'			)";			$mysqli->query($query_dsg);						echo "Oprettelse af nyt skema er nu fuldført!";			echo "<br />";			echo "Vent 5-10 sekunder for at blive diregeret videre!";			echo "<br />";			echo "Hvis du stadig ser denne besked efter 5-10 sekunder, klik på linket under her!";			echo "<br />";			echo "<br />";			echo "<a href='dataskema.php'>-> VIDERE <-</a>";						header( "refresh:5; url = dataskema.php" );		}		else		{			echo "Ingen ''POST[SUBMIT]'' data modtaget!";			echo "<br />";			echo "Returner til forrige side og prøv igen!";			echo "<br />";			echo "Tilkald en koder hvis dette problem ikke løses anden eller tredje gang ved opdateringen!";			echo "<br />";			echo "<a href='dataskema.php?dataskema_action=new_data'>-> TILBAGE <-</a>";		}	}	else	{		echo "No (POST) data!";		echo "<br />";		echo "<a href='dataskema.php?dataskema_action=edit&id_run=$id_run'>-> TILBAGE <-</a>";	}}?>

Now, if i am going to add radio buttons in the system, how do i do that? Kinda first time i use radio buttons in my system actually -.-'...

Ideas?

 

Thanks! :D

Link to comment
Share on other sites

not sure what you mean, but this is a picture of the form and what i mean by form section:

http://www.mediafire.com/view/p45ra2mzedtp221/sec.PNG

The idea is that for each section in the form, i will have one table.. that is how i designed the database so far, if i didn't do like that then it would be toooo complicated later on since the customer wants ALOT of functions later on added to this script.

 

Anyways, check-boxes is a good idea, but how should i add them? Could you give me an example etc? Would help ALOT! x)

 

And ohh... one thing more, in case you wish to checkout the website to see which one i'm currently working on, this is the one:

 

(http : // www . rightmatch . dk)

 

and in case you wonder, this is how my current form looks like:

// Skema Form - Normal			echo "<form method='post' enctype='multipart/form-data' autocomplete='off' action=''>";								// Form ID & Saved Secret				echo "<input type='hidden' name='customer_form_id' value='".$row['dsg_id_runner']."' />";				echo "<input type='hidden' name='customer_form_saved_secret' value='".$row['dsg_saved_secret_id']."' />";								// Titel				echo "<fieldset>";					echo "<legend><u>Data Skema Til Ny Kunde</u></legend>";				echo "</fieldset>";								// Information				echo "<fieldset>";					echo "<legend><u>INFO</u></legend>";					echo "Vi anbefaler meget at du som kunde eller ledig person hos os udfylder alle felterne nedenfor i formularen, også selvom du ikke har de forskellige datater vi skal have. Dette vil hjælpe os meget såvel som dig, så tænk dig om.";										echo "<br /><br />";										echo "Husk at denne form låses så snart du sender den afsted i bunden af siden her.";										echo "<br /><br />";										echo "Der vil være mulighed for at 'Gemme' alle dine handlinger og du vil få genereret en kode som du skal bruge næste gang du kommer på siden her for at fortsætte hvor du slap.";										echo "<br /><br />";										echo "Mange hilsner, RightMatch.";				echo "</fieldset>";								// Navn				echo "<fieldset>";					echo "<legend>Navn</legend>";					echo "<input type='text' name='fornavn' placeholder='Fornavn' />";					echo "<input type='text' name='mellemnavn' placeholder='Mellemnavn' />";					echo "<input type='text' name='efternavn' placeholder='Efternavn' />";									echo "</fieldset>";								// Adresse og Kontaktoplysninger				echo "<fieldset>";					echo "<legend>Kontaktoplysninger</legend>";					echo "<input type='text' name='info_gadenavn' placeholder='Gadenavn' />";					echo "<input type='text' name='info_nr' placeholder='Nr' />";					echo "<input type='text' name='info_etage' placeholder='Etage' />";					echo "<select name='info_side'>";						echo "<option value='0'>Vælg Side</option>";						$info_side_query = "SELECT dsgfs_id, dsgfs_name FROM dataskema_generator_forms_select WHERE dsgfs_identifiers = 1";						$info_side_result = $mysqli->query($info_side_query);						while ($row = $info_side_result->fetch_assoc())						{							echo "<option value='" .$row['dsgfs_id']."'>" .$row['dsgfs_name']."</option>";						}					echo "</select>";					echo "<input type='text' name='info_postnr' placeholder='Post-nr' />";					echo "<input type='text' name='info_by' placeholder='By' />";					echo "<input type='text' name='info_land' placeholder='Land' />";					echo "<input type='email' name='info_email' placeholder='Email' />";					echo "<input type='tel' name='info_telefon' placeholder='Telefon' />";					echo "<input type='tel' name='info_mobil' placeholder='Mobil' />";				echo "</fieldset>";								// Fødselsdato				echo "<fieldset>";					echo "<legend>Fødselsdato</legend>";					echo "<input type='date' name='foedsel_dato' placeholder='Dato (000-00-00 / År-Måned-Dag)' />";				echo "</fieldset>";								// Nuværende Stilling				echo "<fieldset>";					echo "<legend>Nuværende Stilling</legend>";					echo "<input type='text' name='stilling_titel' placeholder='Stillingens Titel' />";					echo "<input type='text' name='stilling_virksomhed' placeholder='Virksomhedens Navn' />";					echo "<select name='stilling_job'>";						echo "<option value='0'>Søgende eller Ledig?</option>";						$info_side_query = "SELECT dsgfs_id, dsgfs_name FROM dataskema_generator_forms_select WHERE dsgfs_identifiers = 2";						$info_side_result = $mysqli->query($info_side_query);						while ($row = $info_side_result->fetch_assoc())						{							echo "<option value='" .$row['dsgfs_id']."'>" .$row['dsgfs_name']."</option>";						}					echo "</select>";				echo "</fieldset>";								// Civiltilstand				echo "<fieldset>";					echo "<legend>Din Civiltilstand</legend>";					echo "<select name='civil_tilstand'>";						echo "<option value='0'>Civil Status</option>";						$info_side_query = "SELECT dsgfs_id, dsgfs_name FROM dataskema_generator_forms_select WHERE dsgfs_identifiers = 3";						$info_side_result = $mysqli->query($info_side_query);						while ($row = $info_side_result->fetch_assoc())						{							echo "<option value='" .$row['dsgfs_id']."'>" .$row['dsgfs_name']."</option>";						}					echo "</select>";					echo "<input type='text' name='civil_drengehjemme' placeholder='Drenge Hjemmeboende' />";					echo "<input type='text' name='civil_drengesalder' placeholder='Deres Aldre (10,21,22,33)' />";					echo "<input type='text' name='civil_pigerhjemme' placeholder='Piger Hjemmeboende' />";					echo "<input type='text' name='civil_pigersalder' placeholder='Deres Aldre (10,21,22,33)' />";					echo "<select name='civil_hvordan'>";						echo "<option value='0'>Hvordan Kom De Til?</option>";						$info_side_query = "SELECT dsgfs_id, dsgfs_name FROM dataskema_generator_forms_select WHERE dsgfs_identifiers = 4";						$info_side_result = $mysqli->query($info_side_query);						while ($row = $info_side_result->fetch_assoc())						{							echo "<option value='" .$row['dsgfs_id']."'>" .$row['dsgfs_name']."</option>";						}					echo "</select>";				echo "</fieldset>";								// Kundens Billede				echo "<fieldset>";					echo "<legend>Upload Billede</legend>";					echo "<input type='file' name='billede' />";				echo "</fieldset>";								// Beskrivelse af en selv				echo "<fieldset>";					echo "<legend>Beskrivelse Af Dig Selv Via Egne Ord</legend>";					echo "<textarea name='beskriv_dig_selv' rows='15' style='width: 100% !important;' placeholder='Beskriv dig selv med dine egne ord i denne tekst boks.'>"."</textarea>";				echo "</fieldset>";								// Nøgleord				echo "<fieldset>";					echo "<legend>Giv 5 Nøgleord Om Dig Selv</legend>";					echo "<input type='text' name='noegleord_et' placeholder='Nøgleord 1' />";					echo "<input type='text' name='noegleord_to' placeholder='Nøgleord 2' />";					echo "<input type='text' name='noegleord_tre' placeholder='Nøgleord 3' />";					echo "<input type='text' name='noegleord_fire' placeholder='Nøgleord 4' />";					echo "<input type='text' name='noegleord_fem' placeholder='Nøgleord 5' />";				echo "</fieldset>";								// Egen Karakterisering				echo "<fieldset>";					echo "<legend>Karakteriser Dig Selv</legend>";					echo "<textarea name='karakterisering' rows='15' style='width: 100% !important;' placeholder='TEKST'>"."</textarea>";				echo "</fieldset>";								// Tilføjelser				echo "<fieldset>";					echo "<legend>Tilføjelser Til Din Ansøgning</legend>";					echo "<textarea name='tilfoejelser' rows='15' style='width: 100% !important;' placeholder='TEKST'>"."</textarea>";				echo "</fieldset>";								// 1) Styrke				echo "<fieldset>";					echo "<legend>Styrke I Det Faglige Såvel Som Personligt?</legend>";					echo "<textarea name='styrke' rows='15' style='width: 100% !important;' placeholder='TEKST'>"."</textarea>";				echo "</fieldset>";								// 2) Største Succes				echo "<fieldset>";					echo "<legend>Nævn Største Succes?</legend>";					echo "<textarea name='stoerste_success' rows='15' style='width: 100% !important;' placeholder='TEKST'>"."</textarea>";				echo "</fieldset>";								// Svaghed				echo "<fieldset>";					echo "<legend>Har Du Nogle Svagheder?</legend>";					echo "<textarea name='svaghed' rows='15' style='width: 100% !important;' placeholder='TEKST'>"."</textarea>";				echo "</fieldset>";								// Under Pres				echo "<fieldset>";					echo "<legend>Hvordan Er Du Under Pres?</legend>";					echo "<textarea name='under_pres' rows='15' style='width: 100% !important;' placeholder='TEKST'>"."</textarea>";				echo "</fieldset>";								// Konfliktsituation Takling				echo "<fieldset>";					echo "<legend>Hvordan Tackler Du En Konfliktsituation?</legend>";					echo "<textarea name='konflikt_takling' rows='15' style='width: 100% !important;' placeholder='TEKST'>"."</textarea>";				echo "</fieldset>";								// Motiv				echo "<fieldset>";					echo "<legend>Hvad Er Dit Motiv For At Søge Ind I Stillingen?</legend>";					echo "<textarea name='motiv' rows='15' style='width: 100% !important;' placeholder='TEKST'>"."</textarea>";				echo "</fieldset>";								// Karriereønsker				echo "<fieldset>";					echo "<legend>Karriereønsker På 5-10 Plan?</legend>";					echo "<textarea name='karriere_oensker' rows='15' style='width: 100% !important;' placeholder='TEKST'>"."</textarea>";				echo "</fieldset>";								// Ryger				echo "<fieldset>";					echo "<legend>Ryger Du?</legend>";					echo "<select name='ryger'>";						echo "<option value='0'>Ja / Nej?</option>";						$info_side_query = "SELECT dsgfs_id, dsgfs_name FROM dataskema_generator_forms_select WHERE dsgfs_identifiers = 5";						$info_side_result = $mysqli->query($info_side_query);						while ($row = $info_side_result->fetch_assoc())						{							echo "<option value='" .$row['dsgfs_id']."'>" .$row['dsgfs_name']."</option>";						}					echo "</select>";				echo "</fieldset>";								// Sygdomme				echo "<fieldset>";					echo "<legend>Lider Du Af Nævnværdige Kroniske Sygdomme?</legend>";					echo "<textarea name='sygdomme' rows='15' style='width: 100% !important;' placeholder='TEKST'>"."</textarea>";				echo "</fieldset>";								// Opsigelsesvarsel				echo "<fieldset>";					echo "<legend>Opsigelsesvarsel</legend>";					echo "OBS: skriv (KUN) i tal ved måneder og særligt felterne og normal tekst under klausuler boksen.";					echo "<input type='text' name='varsel_antal_mdr' placeholder='Antal Måneder' />";					echo "<input type='text' name='varsel_saerligt_mdr' placeholder='Særligt' />";					echo "<textarea name='klausuler' rows='15' style='width: 100% !important;' placeholder='Relevante Klausuler'>"."</textarea>";				echo "</fieldset>";								// Gageforventninger				echo "<fieldset>";					echo "<legend>Gageforventninger</legend>";										// Ønskede Månedsløn					echo "Hvad er din ønskede månedsløn (inkl. pension, bonus, m.m)? Valuta";					echo "<input type='text' name='gage_oenskede_maaneds_loen' placeholder='Månedsløn Ønske' />";										// Smærtegrænse					echo "Hvad er din smærtegrænse for månedsløn (inkl. pension)? Valute *";					echo "<input type='text' name='gage_smaertegraense' placeholder='Smærtegrænse' />";										// Nuværende Månedsløn					echo "Nuværende Månedsløn";					echo "<input type='text' name='gage_nuvaerende_maaneds_loen' placeholder='VALUTA' />";										// Pension					echo "Hvad er din pension på?";					echo "<input type='text' name='gage_pension_valuta' placeholder='VALUTA' />";										// Bonus					echo "Har du bonus?";					echo "<select name='gage_bonus_spoergsmaal'>";						echo "<option value='0'>Ja / Nej?</option>";						$info_side_query = "SELECT dsgfs_id, dsgfs_name FROM dataskema_generator_forms_select WHERE dsgfs_identifiers = 6";						$info_side_result = $mysqli->query($info_side_query);						while ($row = $info_side_result->fetch_assoc())						{							echo "<option value='" .$row['dsgfs_id']."'>" .$row['dsgfs_name']."</option>";						}					echo "</select>";					echo "<input type='text' name='gage_bonus_valuta' placeholder='VALUTA' />";										// Har du PC/ADSL?					echo "Har du PC/ADSL?";					echo "<select name='gage_pcadsl'>";						echo "<option value='0'>Ja / Nej?</option>";						$info_side_query = "SELECT dsgfs_id, dsgfs_name FROM dataskema_generator_forms_select WHERE dsgfs_identifiers = 7";						$info_side_result = $mysqli->query($info_side_query);						while ($row = $info_side_result->fetch_assoc())						{							echo "<option value='" .$row['dsgfs_id']."'>" .$row['dsgfs_name']."</option>";						}					echo "</select>";										// Har du bil?					echo "Har du bil?";					echo "<select name='gage_bil'>";						echo "<option value='0'>Ja / Nej?</option>";						$info_side_query = "SELECT dsgfs_id, dsgfs_name FROM dataskema_generator_forms_select WHERE dsgfs_identifiers = 8";						$info_side_result = $mysqli->query($info_side_query);						while ($row = $info_side_result->fetch_assoc())						{							echo "<option value='" .$row['dsgfs_id']."'>" .$row['dsgfs_name']."</option>";						}					echo "</select>";										// Har du Telefon?					echo "Har du Telefon?";					echo "<select name='gage_telefon'>";						echo "<option value='0'>Ja / Nej?</option>";						$info_side_query = "SELECT dsgfs_id, dsgfs_name FROM dataskema_generator_forms_select WHERE dsgfs_identifiers = 9";						$info_side_result = $mysqli->query($info_side_query);						while ($row = $info_side_result->fetch_assoc())						{							echo "<option value='" .$row['dsgfs_id']."'>" .$row['dsgfs_name']."</option>";						}					echo "</select>";										// Har du Mobil?					echo "Har du Mobil?";					echo "<select name='gage_mobil'>";						echo "<option value='0'>Ja / Nej?</option>";						$info_side_query = "SELECT dsgfs_id, dsgfs_name FROM dataskema_generator_forms_select WHERE dsgfs_identifiers = 10";						$info_side_result = $mysqli->query($info_side_query);						while ($row = $info_side_result->fetch_assoc())						{							echo "<option value='" .$row['dsgfs_id']."'>" .$row['dsgfs_name']."</option>";						}					echo "</select>";										// Andet?					echo "Andet?";					echo "<textarea name='gage_andet' rows='15' style='width: 100% !important;' placeholder='Andet?'>"."</textarea>";				echo "</fieldset>";								// Eksamensbeviser o.a				echo "<fieldset>";					echo "<legend>Vil Du Kunne Fremskaffe Eksamensbeviser o.a.?</legend>";					echo "Ja / Nej -> Hvis nej er valgt så skal en dybere forklaring skrives i tekstfeltet nedenunder.";					echo "<select name='eksamen_ja_nej'>";						echo "<option value='0'>Ja / Nej?</option>";						$info_side_query = "SELECT dsgfs_id, dsgfs_name FROM dataskema_generator_forms_select WHERE dsgfs_identifiers = 11";						$info_side_result = $mysqli->query($info_side_query);						while ($row = $info_side_result->fetch_assoc())						{							echo "<option value='" .$row['dsgfs_id']."'>" .$row['dsgfs_name']."</option>";						}					echo "</select>";										echo "<textarea name='eksamen_forklaring' rows='15' style='width: 100% !important;' placeholder='Forklaring'>"."</textarea>";				echo "</fieldset>";								// Lønnet Beskæftigelse				echo "<fieldset>";					echo "<legend>Andet Lønnet Beskæftigelse?</legend>";					echo "<textarea name='anden beskaeftigelses_loen' rows='15' style='width: 100% !important;' placeholder='Anden lønnet ydelse? Skriv da her, gerne så detaljeret som muligt.'>"."</textarea>";				echo "</fieldset>";								// Referencer				echo "<fieldset>";					echo "<legend>Har Du Nogle Referencer?</legend>";					echo "Reference: 1,2,3";					echo "<br /><br />";										echo "<u>Reference 1</u>";					echo "<input type='text' name='ref_one' placeholder='Reference 1' />";					echo "Navn 1";					echo "<input type='text' name='ref_one_navn' placeholder='Navn' />";					echo "Titel 1";					echo "<input type='text' name='ref_one_titel' placeholder='Titel' />";					echo "Virksomhed 1";					echo "<input type='text' name='ref_one_virksomhed' placeholder='Virksomhed' />";					echo "Relation 1";					echo "<input type='text' name='ref_one_relation' placeholder='Relation' />";					echo "Telefon 1";					echo "<input type='tel' name='ref_one_tlf' placeholder='Telefon' />";					echo "Mobil 1";					echo "<input type='tel' name='ref_one_mobil' placeholder='Mobil' />";					echo "Mail 1";					echo "<input type='email' name='ref_one_mail' placeholder='Mail' />";										echo "<u>Reference 2</u>";					echo "<input type='text' name='ref_two' placeholder='Reference 2' />";					echo "Navn 2";					echo "<input type='text' name='ref_two_navn' placeholder='Navn' />";					echo "Titel 2";					echo "<input type='text' name='ref_two_titel' placeholder='Titel' />";					echo "Virksomhed 2";					echo "<input type='text' name='ref_two_virksomhed' placeholder='Virksomhed' />";					echo "Relation 2";					echo "<input type='text' name='ref_two_relation' placeholder='Relation' />";					echo "Telefon 2";					echo "<input type='tel' name='ref_two_tlf' placeholder='Telefon' />";					echo "Mobil 2";					echo "<input type='tel' name='ref_two_mobil' placeholder='Mobil' />";					echo "Mail 2";					echo "<input type='email' name='ref_two_mail' placeholder='Mail' />";										echo "<u>Reference 3</u>";					echo "<input type='text' name='ref_three' placeholder='Reference 3' />";					echo "Navn 3";					echo "<input type='text' name='ref_three_navn' placeholder='Navn' />";					echo "Titel 3";					echo "<input type='text' name='ref_three_titel' placeholder='Titel' />";					echo "Virksomhed 3";					echo "<input type='text' name='ref_three_virksomhed' placeholder='Virksomhed' />";					echo "Relation 3";					echo "<input type='text' name='ref_three_relation' placeholder='Relation' />";					echo "Telefon 3";					echo "<input type='tel' name='ref_three_tlf' placeholder='Telefon' />";					echo "Mobil 3";					echo "<input type='tel' name='ref_three_mobil' placeholder='Mobil' />";					echo "Mail 3";					echo "<input type='email' name='ref_three_mail' placeholder='Mail' />";				echo "</fieldset>";								// Relevant Om Dig				echo "<fieldset>";					echo "<legend>Vil Der Være Noget Relevant Om Dig Hvis Man Søger Via google Som Eksempel?</legend>";					echo "<textarea name='relevant' rows='15' style='width: 100% !important;' placeholder='Efterlad denne blank hvis der intet er.'>"."</textarea>";				echo "</fieldset>";								// Fritid				echo "<fieldset>";					echo "<legend>Hvad Bruger Du Din Fritid På?</legend>";					echo "<textarea name='fritid' rows='15' style='width: 100% !important;' placeholder='Skriv hvad din fritid går på.'>"."</textarea>";				echo "</fieldset>";								// Jobsøgende, Jobsamtale, Har været til jobsamtale?				echo "<fieldset>";					echo "<legend>Jobsøgende, Jobsamtale, Har Du Været Til Jobsamtale?</legend>";										echo "Jobsøgende?";					echo "<select name='jobsoende_ja_nej'>";						echo "<option value='0'>Ja / Nej?</option>";						$info_side_query = "SELECT dsgfs_id, dsgfs_name FROM dataskema_generator_forms_select WHERE dsgfs_identifiers = 12";						$info_side_result = $mysqli->query($info_side_query);						while ($row = $info_side_result->fetch_assoc())						{							echo "<option value='" .$row['dsgfs_id']."'>" .$row['dsgfs_name']."</option>";						}					echo "</select>";										echo "Har du en Jobsamtale?";					echo "<select name='jobsamtale_ja_nej'>";						echo "<option value='0'>Ja / Nej?</option>";						$info_side_query = "SELECT dsgfs_id, dsgfs_name FROM dataskema_generator_forms_select WHERE dsgfs_identifiers = 13";						$info_side_result = $mysqli->query($info_side_query);						while ($row = $info_side_result->fetch_assoc())						{							echo "<option value='" .$row['dsgfs_id']."'>" .$row['dsgfs_name']."</option>";						}					echo "</select>";					echo "Virksomhed";					echo "<input type='text' name='jobsamtale_virksomhed' placeholder='Virksomhed' />";					echo "Dato";					echo "<br />";					echo "<input type='date' name='jobsamtale_dato' />";										echo "<br />";					echo "<br />";										echo "Har du været til jobsamtale?";					echo "<select name='jobsamtale_vaeret_ja_nej'>";						echo "<option value='0'>Ja / Nej?</option>";						$info_side_query = "SELECT dsgfs_id, dsgfs_name FROM dataskema_generator_forms_select WHERE dsgfs_identifiers = 14";						$info_side_result = $mysqli->query($info_side_query);						while ($row = $info_side_result->fetch_assoc())						{							echo "<option value='" .$row['dsgfs_id']."'>" .$row['dsgfs_name']."</option>";						}					echo "</select>";					echo "Virksomhed";					echo "<input type='text' name='jobsamtale_vaeret_virksomhed' placeholder='Virksomhed' />";					echo "Dato";					echo "<br />";					echo "<input type='date' name='jobsamtale_vaeret_dato' />";				echo "</fieldset>";								// GEM eller AFSLUT				echo "<fieldset>";					echo "<legend>Gem eller Afslut!</legend>";					//echo "<input type='submit' name='submit_gem' style='float: left;' value='Gem' />";					//echo "<input type='submit' name='submit_afslut' style='float: left;' value='Afslut' />";					echo "<button type='submit' name='submit_gem' formaction='skema_update.php?save=1' style='float: left;'>Gem</button>";					echo "<button type='submit' name='submit_afslut' formaction='skema_update.php' style='float: left;'>Afslut</button>";				echo "</fieldset>";								// GEM OG BILLEDE NOTE!				echo "<fieldset>";					echo "<legend>VIGTIG!</legend>";					echo "Når du <u>GEMMER</u> istedet for at afslutte så gemmes dit billede ikke! Dette skal vælges og uploades <u>IGEN!</u> når du skal fortsætte via den gemte form når du vælger at gøre dette på et senere tidspunkt!";				echo "</fieldset>";							echo "</form>";

Tell me what you think etc?

I also need to make a picture upload.. i did try taking a look at the one W3S provided at their website as an example, but having trouble adding it to the system for some reason :/

 

Hoping you got an idea? Would help alot :P

Thanks! ;)

Link to comment
Share on other sites

Anyways, check-boxes is a good idea, but how should i add them? Could you give me an example etc? Would help ALOT! x)

<input type="checkbox" name="enabled1" value="true">

The idea is that for each section in the form, i will have one table..

It sounds like it would be much more flexible to have one table that holds all sections. Any design where your code has to change the database structure is a bad design. A good design is one where the database structure never has to change.

Tell me what you think etc?

I think that's a ton of code with way too many echo statements outputting HTML, which should be replaced with a template. PHP should be separate from HTML or else you're going to have a major headache down the road when it's time to change anything.
Link to comment
Share on other sites

oops... i ment what you said, one table holding all the information....

 

The idea is that once the candidate has filled out the form, the customer wont be able to re-enter the same URL and use that url to enter the same formular...

 

the database i already have covered from the formular site, i just need the setup for the "Enable / Disable" part... do you have a clue etc? Right now i have 2 tables.

 

1 for the candidates information, thought it would be better to seperate the candidate from the form.

And 1 for the actual formular.

 

1 candidate equals 1 form in the database everytime another candidate is being created from the admin side.

 

However i do see what you mean about the PHP/HTML thing... i just have my own template to run it with, sort of, so HTML wont work x)

 

But bottom line is, when i add the checkboxes and adding them to the table i make... like int foreach row etc... how to make it? I mean should i run it over a foreach loop etc to only add those that is checked and not checked?

 

What you think? :)

Link to comment
Share on other sites

And 1 for the actual formular.

I have no idea what you mean by "formular".

However i do see what you mean about the PHP/HTML thing... i just have my own template to run it with, sort of, so HTML wont work x)

What? You're using some language other than HTML to send to the browser? It looks to me like you're using HTML. Regardless of what you're actually outputting though, it's much better to have PHP gather all of the data that is needed, then load a template, send the data to the template, and then get the output. You can look up Smarty if you want an example of how to use templates. That's much more flexible than giant blocks of echo statements. When the vast majority of your PHP code does nothing more than print a string which never changes, that's a major sign that you don't need PHP to do that. PHP is for dynamic pages and data. Your static output can go in a template file. It doesn't matter if it's HTML or not.

But bottom line is, when i add the checkboxes and adding them to the table i make... like int foreach row etc... how to make it? I mean should i run it over a foreach loop etc to only add those that is checked and not checked?

I don't know if I understand that question, but like I said I store boolean values in the database as tinyint(1) columns, either a 0 or 1. You can use that data however you want, if you want to show various form fields but set them to disabled, or not show them at all, or whatever you want to do.
Link to comment
Share on other sites

Sorry for late reply, exams coming soon, so studying all i can and only coding a little bit x)

 

Anyways what i basically ment is that i am currently trying to build my own template/cms, so whenever i use the "echo" as one normally would, they will be shown as HTML, but with protected variables around it.. sort of, still in beta mode :P

 

Right now i'm about to make the Checkboxes.

When those are added, my plan is to add a foreach loop checking those that is checked, and not checked. Those that are checked will be updated in the database, and the other simply wont.

 

What you think? :)

 

Thanks :)

Link to comment
Share on other sites

Anyways what i basically ment is that i am currently trying to build my own template/cms, so whenever i use the "echo" as one normally would, they will be shown as HTML, but with protected variables around it..

I don't know what that means, what I know is that you posted code where about 90% does nothing except output a static string. You do not need PHP for that. Put your static output outside of a PHP block so that PHP doesn't have to spend time processing something that doesn't need to be processed. It's not efficient, it's bad design, and it violates the principle of separation of logic and presentation. Hopefully you understand all of these concepts while you're trying to design your own template engine.

When those are added, my plan is to add a foreach loop checking those that is checked, and not checked. Those that are checked will be updated in the database, and the other simply wont.

That sounds fine, that's how checkboxes are typically handled. Keep in mind that unchecked boxes are not submitted at all.
Link to comment
Share on other sites

question.

 

The database table-rows all has a default as 0...

 

my question is now, how to make checked boxes give a value of 1 foreach individual... little unclear about that Oo?

 

Thanks x)

Link to comment
Share on other sites

  • 3 weeks later...

hi, sorry for not writing before now! Busy week with my midway exams (damn -.-')... but it works! Thanks for your help! :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...