php, html 소스 질문입니다..

roeoen의 이미지

제가 지금 php공부를 하고있습니다..
그런데 제가 간단한 소스를 html, php파일을 만들어서 explorer로 확인을 합니다..
그런데 html, php파일에 html, php소스를 짜서 php, html파일로 접속하여 explorer에 어떤값을 입력하여..
확인 버튼을 누르면 html, php파일로 접속하면 html, php에 파일에서 입력한 값이 php파일로 넘어오면서...
입력값이 explorer화면에 나와야 됨니다..
그런데 페이지 여는거는 오류 없이 잘나오는대 값을 출력하지 않습니다..
이게 어떤 문제지 아시는 분은 좀 알켜주세요~~;;
글구 개인 서버를 쓰고 있습니다..

웹으로 접근 하는 경로는
202.30.32.14/~roeoen/z/ex41.html 입니다..

ex41.html소스
<script language="javascript">
function output(form) {

if(!form.value_1.value) {
alert("첫번째 값을 입력하세요!");
form.value_2.focus();
return;
}
if(!form.value_2.value) {
alert("두 번째 값을 입력하세요!");
form.value_2focus();
return;
}
for(var i =0; i < form.operator.length; i++) {

if(!form.operator[i].checked) {
break;
}
}
if(i == form.operator.length) {
alert("수행할 연산자를 선택하세요!");
return;
}
form.submit();
}
</script>

<form name="select_form" method="post" action="aa.php">
두 값을 입력하세요!<br><br>

<input type="text" name="value_1" size="4">
<input type="text" name="value_2" size="4"><br><br>

수행할 연산자를 선택하세요!<br><br>

<input type="radio" name="operator" value="add">덧셈<br>
<input type="radio" name="operator" value="minus">뺄셈<br>
<input type="radio" name="operator" value="multiply">곱셈<br>
<input type="radio" name="operator" value="divide">나눗셈<br>

<input type="button" value="계산" onClick="output(this.form)">
</form>

aa.php 소스
<?
switch ($operator) {
case ("add"):
$result = $value_1 + $value_2;
echo("$value_1 + $value_2 = $result");
break;

case ("minus"):
$result = $value_1 - $value_2;
echo("$value_1 - $value_2 = $result");
break;

case ("multiply"):
$result = $value_1 * $value_2;
echo("$value_1 * $value_2 = $result");
break;

case ("divide"):
$result = $value_1 / $value_2;
echo("$value_1 / $value_2 = $result");
break;
}
?>

익명 사용자의 이미지

register_globals에 대해 읽어 보세요.

elflord의 이미지

[register_globals = ON] 으로 하시면 값이 나오겠지만 보안상 추천드릴수는 없고요.
가능하면 $_POST["text1"] 과 같은 방식으로 페이지간 데이터를 받아서 쓰시길 권해드립니다.


===== ===== ===== ===== =====
그럼 이만 총총...[竹]
http://elflord.egloos.com

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.