[완료] get으로 텍스트값 전송

artop0420의 이미지

----- 1.php -----

<head>
 
<script>
 
function reg() {
 
location.href='2.php?name=<? $text ?>;
 
}
 
</script>
 
<body>
 
<input type=text  id=text_box>
 
<input type=button value="등록 onclick="reg();">
 
</body>

----- 2.php -----

<? $_GET['name']; ?>

-------------------------

변수 값 전송때문에 구글링하고 Kldp에 눈이 빠지도록 찾았는데 오히려 더 엉망이 되었네요.ㅠ_ㅠ

이런 소스가 있다고 가정하에.

제가 진행하고 싶은 것은 text박스에 있는 내용을 가지고 get으로 전송시키려고 힙니다만.

주소를 찍으면 빈값이네요.. 수동으로 '2.php?name=test'라고 하면 되구요.

어떻게 해야할까요?

mithrandir의 이미지

1. 그냥 폼에서 submit하면 안되나요?
2. $_GET['name'] 아니에요? $_GET[$name] 도 되는건가요?;

언제나 삽질 - http://tisphie.net/typo/
프로그래밍 언어 개발 - http://langdev.net

언제나 삽질 - http://tisphie.net/typo/
프로그래밍 언어 개발 - http://langdev.net

artop0420의 이미지

1. 실제로 적용되는 페이지에는 타켓되는 페이지 url이 다 달라서요;;;(지식 부족으로.. 가장 적합하다고 생각된 부분이 이 부분입니다.. ^^;;)
2. 실소스를 올리지는 못하고, 테스트 소스를 작성하다보니 오타였습니다. 수정할수 있으면 수정할께요. $_GET['name'] 게 맞습니다.

--- 나는요? ---

리눅스와 솔라리스 그리고 윈도우의 껍데기만 맛보고 있습니다.

--- 나는요? ---

리눅스와 솔라리스 그리고 윈도우의 껍데기만 맛보고 있습니다.

김동수의 이미지

<form name="sform">
...
<input type="text" name="stext">
...
</form>

일 경우에.. location.href='2.php?name='+document.sform.stext.value
정도로 되지 않을까 합니다.
-------------------------------------
김동수 - Prototype for Evolution

김동수 - Prototype for Evolution

artop0420의 이미지

감사합니다~ 텍스트값 전송됩니다.

--- 나는요? ---

리눅스와 솔라리스 그리고 윈도우의 껍데기만 맛보고 있습니다.

--- 나는요? ---

리눅스와 솔라리스 그리고 윈도우의 껍데기만 맛보고 있습니다.

세이군의 이미지

location.href='2.php?name=<? $text ?>;
위 내용을 최대한 살리면서 바꾼다면
location.href='2.php?name=<?=$text ?>;
입니다.
이는 <?php echo $text; ?> 하고 같은 의미 입니다.
(PHP 4.3 이상에서 가능)

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.