안녕하세요 거기에 체크 박스가있는 확인란 (특정 ID) 및 확인란을 클릭하면, 더 많은 질문 (기본적으로 텍스트 필드) 팝업됩니다 쪽으로. 그러나 일부 체크 박스에는 같은 질문이 있습니다. 그런 다음 데이터를 mysql 데이터베이스에 저장합니다. 그리고 나는 그것을 나중에 보여주고있다. 그리고 질문 : 어떻게 현재의 ID 및 원하는 텍스트 필드에만 게시 할 스위치 문 또는 일부 알고리즘을 만드는 방법입니다.일부 팝업 질문 반복으로 PHP/MySQL의 양식
FO 그림 :
0-100kg (Checkbox1)
- Which material? (textfield with name=material)
- Circle radius? (textfield with name=radius)
100-500kg (Checkbox2)
- Which material? (textfield with name=material)
- Circle radius? (textfield with name=radius)
500-1000kg (Checkbox3)
- Which material? (textfield with name=material)
- Circle radius? (textfield with name=radius)
- Roots? (textfield with name=roots)
번호 :
형태 :
<label class="collapse" for="100to500"><b>100 - 500kg</b></label>
<input id="100to500" type="checkbox" name="100to500">
<div><br>
Which material? <input type="text" name="material"/><br>
Circle radius? <input type="text" name="radius"/><br></div>
<label class="collapse" for="500to1000"><b>500 - 1000kg</b></label>
<input id="500to1000" type="checkbox" name="500to1000">
<div><br>
Which material? <input type="text" name="material"/><br>
Circle radius? <input type="text" name="radius"/><br>
Roots? <input type="text" name="roots"/><br></div>
PHP :
기억 변수 :
$material=mysql_real_escape_string($_POST['material']);
$radius=mysql_real_escape_string($_POST['radius']);
$roots=mysql_real_escape_string($_POST['roots']);
$100to500 = isset($_POST['100to500']) ? $_POST['100to500'] : '0';
$500to1000= isset($_POST['500to1000']) ? $_POST['500to1000'] : '0';
,
나는 어떻게 든 동일한 ID (데이터베이스 행)에 모든 데이터를 저장하고 클릭 한/채워진 데이터 만 저장할 것이라고 accopmlish하려고합니다. 나는 어리석은 설명이지만 2 주 동안 만 PHP를 사용하고 있으므로 완전한 멍청이 임.
고맙습니다.
하지 귀하의 질문에 직접 대답을하지만 보인다 당신이 2 개의 질문 텍스트 필드 + 체중 선택기를 갖는 것이 더 낫다면. 이상하게 각 무게 종류의 밑에 일련의 중복 질문이있는 대신에. –
좋아, 나는 누군가가 downvoted 것을 본다, 당신이이 게시물이 불필요하다고 생각한다면 당신은 적어도 나를 리드 할 수있다. – rudyherehello
네, 저에게도 더 논리적으로 보입니다. 답변 해 주셔서 감사합니다. – rudyherehello