problema formular

Discutii despre script-uri si coduri PHP-MySQL, precum si lucru cu XML in PHP.
Wayn3
Mesaje:111

problema formular

merge cu php ... dar din pacate nu functioneaza .. ma redirecteaza inapoi la pagina formularului :-??

MarPlo Mesaje:4343
Cum am mai precizat "nu da True toate acele conditii din if(...) si atunci se executa ce e in else {...}, acel redirect.
Solutia: sa refaci si sa simplifici acel sir cu conditii din if(...).

Wayn3 Mesaje:111
cum pot face asta ? scuze dar nu prea ma pricep eu la php bine

MarPlo Mesaje:4343
Asta depinde de cum e formularul ce trimite datele, cum e facut, ce campuri are.
Daca nu te pricepi la php, ai nimerit bine; pe acest site e un curs de php. Pt. lucru cu formulare, poate te ajuta ce e in lectia: Utilizare formulare

Wayn3 Mesaje:111
de exemplu o parte din formular arata asa

Cod: Selectaţi tot

	<form action="insert-anunt.php" method="post" name="formAdauga" id="signupform" enctype="multipart/form-data">
		
		<h2>Informatii persoana</h2>
		
			<div class="left">
				<label for="nume" id="nume_text">Nume &nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;</label>
				<input type="text" class="text" name="nume"  id="nume" />
			</div>
			<div class="left">
				<label for="prenume" id="prenume">Prenume :&nbsp;</label>
				<input type="text" class="text" name="prenume"  id="Prenume" />
			</div>
			<br >
								<div class="left">
						<label for="regiune">Judet</label>
						<select name="regiune" class="select" id="regiune" >
							<option value="">Alege...</option>
															<option value="AB"  >Alba </option>
															<option value="AR"  >Arad </option>
															<option value="AG"  >Arges </option>
															<option value="BC"  >Bacau </option>
															<option value="BH"  >Bihor </option>
															<option value="BN"  >Bistrita-Nasaud </option>
															<option value="BT"  >Botosani </option>
															<option value="BR"  >Braila </option>
															<option value="BV"  >Brasov </option>
															<option value="BZ"  >Buzau </option>
															<option value="CL"  >Calarasi </option>
															<option value="CS"  >Caras-Severin </option>
															<option value="CJ"  >Cluj </option>
															<option value="CT"  >Constanta </option>
															<option value="CV"  >Covasna </option>
															<option value="DB"  >Dambovita </option>
															<option value="DJ"  >Dolj </option>
															<option value="GL"  >Galati </option>
															<option value="GR"  >Giurgiu </option>
															<option value="GJ"  >Gorj </option>
															<option value="HR"  >Harghita </option>
															<option value="HD"  >Hunedoara </option>
															<option value="IL"  >Ialomita </option>
															<option value="IS"  >Iasi </option>
															<option value="IF"  >Bucuresti-Ilfov </option>
															<option value="MM"  >Maramures </option>
															<option value="MH"  >Mehedinti </option>
															<option value="MS"  >Mures </option>
															<option value="NT"  >Neamt </option>
															<option value="OT"  >Olt </option>
															<option value="PH"  >Prahova </option>
															<option value="SJ"  >Salaj </option>
															<option value="SM"  >Satu-Mare </option>
															<option value="SB"  >Sibiu </option>
															<option value="SV"  >Suceava </option>
															<option value="TR"  >Teleorman </option>
															<option value="TM"  >Timis </option>
															<option value="TL"  >Tulcea </option>
															<option value="VL"  >Valcea </option>
															<option value="VS"  >Vaslui </option>
															<option value="VN"  >Vrancea </option>
													</select>
					</div>

			<div class="right"></div>
				<br clear="all"/>
			<div class="left">
				<label for="email">E-mail : &nbsp;&nbsp;&nbsp;&nbsp;</label>
				<input type="text" class="text" name="email"  id="email" />
			</div>
				
			<div class="left">
				<label for="telefon">Telefon&nbsp;:&nbsp;&nbsp;&nbsp;</label>
				<input type="text" class="text" name="telefon"  id="telefon" />
			</div>

am citit acel curs si l-am citit iar .. dar nu mi-am putut da seama ce am gresit :|

MarPlo Mesaje:4343
Fiecare casuta are un atribut name="valoare", si in "if()" verifici cu "isset($_POST['valoare'])" daca sunt trimise date de la casuta respectiva. Pt. a nu te complica, in acel if(...), adauga doar cateva, cam asa:
if(isset($_POST['nume']) && isset($_POST['text']) && isset($_POST['prenume'])) { ...Cod ce trebuie executat }

Wayn3 Mesaje:111
cred ca am rezolvat ... multumesc :D

Subiecte similare