help on taking textbox value without using a <form>

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shotokan99

    help on taking textbox value without using a <form>

    for instance i do have this element but i dont have a <form>:
    <input type="Text" name="myname" id="myname" size="30"...>

    then i have this link:
    echo'<a href="mypage.ph p?name='.$mynam e.'...>Save</a>';

    i want that $myname will the value of myname textbox. something like
    this:
    $myname= <the value of the textbox>

    then on the side of mypage.php it will catch the values on same
    manner:
    $myname=$_GET['myname'];
    ..
    ..
    ..


    i know this can be easily using <form>...</form>. but if i dont want
    to use a for will it be possible? incase it is, how get the value of
    the textbox and assign it to $myname variable?

  • rickycornell@gmail.com

    #2
    Re: help on taking textbox value without using a &lt;form&gt;

    On May 15, 9:50 pm, shotokan99 <soft_devj...@y ahoo.comwrote:
    for instance i do have this element but i dont have a <form>:
    <input type="Text" name="myname" id="myname" size="30"...>
    >
    then i have this link:
    echo'<a href="mypage.ph p?name='.$mynam e.'...>Save</a>';
    >
    i want that $myname will the value of myname textbox. something like
    this:
    $myname= <the value of the textbox>
    >
    then on the side of mypage.php it will catch the values on same
    manner:
    $myname=$_GET['myname'];
    .
    .
    .
    >
    i know this can be easily using <form>...</form>. but if i dont want
    to use a for will it be possible? incase it is, how get the value of
    the textbox and assign it to $myname variable?
    I'm a little too tired to figure out exactly what you're looking to
    do, but through the fog I think the answer is JavaScript. JavaScript
    can read the value of any input field with an ID, and you can use it
    to modify the href property of a link you have somewhere, I think. I
    know I've used JavaScript, for example, to change the target value of
    a form based on one of the form's inputs before sending. Something
    along those lines.

    Ricky

    Comment

    • shotokan99

      #3
      Re: help on taking textbox value without using a &lt;form&gt;

      ah ok sorry for the inconvenience.. .let me try to explain it clearly.
      usually if we have this:

      <form name=".." method="post" action="my.php" >
      <input type="Text" name="myname" id="myname" size="30"...<Br >
      <input type="submit" name".." value="save">
      </form>

      and my.php will have:

      <?php
      $myname=$_POST['myname'];
      ..
      //processing here....
      ..
      ?>

      now how about if i remove the <form...tag. then instead of a submit
      button ill replace it with a text linking to my.php. it loots
      something like this:

      <input type="Text" name="myname" id="myname" size="30"...<Br >
      <a href="my.php?na me='.$myname.'. ..>Save</a>

      then my.php will look like this:
      <?phpa
      $myname=$_GET['myname'];
      ..
      //processing here....
      ..
      ?>

      my problem is how get the value of the textbox and assign it to
      $myname variable.
      is it possible with php or i need javascript for this matter? i hope i
      was able to explain it clearly




      Comment

      • Jerry Stuckle

        #4
        Re: help on taking textbox value without using a &lt;form&gt;

        shotokan99 wrote:
        ah ok sorry for the inconvenience.. .let me try to explain it clearly.
        usually if we have this:
        >
        <form name=".." method="post" action="my.php" >
        <input type="Text" name="myname" id="myname" size="30"...<Br >
        <input type="submit" name".." value="save">
        </form>
        >
        and my.php will have:
        >
        <?php
        $myname=$_POST['myname'];
        .
        //processing here....
        .
        ?>
        >
        now how about if i remove the <form...tag. then instead of a submit
        button ill replace it with a text linking to my.php. it loots
        something like this:
        >
        <input type="Text" name="myname" id="myname" size="30"...<Br >
        <a href="my.php?na me='.$myname.'. ..>Save</a>
        >
        then my.php will look like this:
        <?phpa
        $myname=$_GET['myname'];
        .
        //processing here....
        .
        ?>
        >
        my problem is how get the value of the textbox and assign it to
        $myname variable.
        is it possible with php or i need javascript for this matter? i hope i
        was able to explain it clearly
        >
        >
        >
        >
        Unless the textbox is in a form, it will never be submitted to the
        server, so PHP will never see it.

        But why not use a form? That's why it's there.

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • ELINTPimp

          #5
          Re: help on taking textbox value without using a &lt;form&gt;

          On May 15, 9:50 pm, shotokan99 <soft_devj...@y ahoo.comwrote:
          for instance i do have this element but i dont have a <form>:
          <input type="Text" name="myname" id="myname" size="30"...>
          >
          then i have this link:
          echo'<a href="mypage.ph p?name='.$mynam e.'...>Save</a>';
          >
          i want that $myname will the value of myname textbox. something like
          this:
          $myname= <the value of the textbox>
          >
          then on the side of mypage.php it will catch the values on same
          manner:
          $myname=$_GET['myname'];
          .
          .
          .
          >
          i know this can be easily using <form>...</form>. but if i dont want
          to use a for will it be possible? incase it is, how get the value of
          the textbox and assign it to $myname variable?
          If I understand your question, you wish to submit your form using a
          textual link rather than a <input type="submit" ... />, button, or
          image. HTML/PHP doesn't support this, but you can do it with a little
          JavaScript. Still use a <form>, though:

          <form method="post" action="my.php" name="hurray_js ">
          <input type="Text" name="myname" id="myname" size="30"...<Br >
          <a href="javascrip t:document.hurr ay_js.submit(); ">Submit</a>
          </form>


          my.php:
          </php
          $myname = $_POST['myname'];
          .....
          ?>

          cheers,

          Steve

          Comment

          • Tom

            #6
            Re: help on taking textbox value without using a &lt;form&gt;


            "Jerry Stuckle" <jstucklex@attg lobal.netwrote in message
            news:zsKdnQh7Mt NtftfbnZ2dnUVZ_ qDinZ2d@comcast .com...
            shotokan99 wrote:
            ah ok sorry for the inconvenience.. .let me try to explain it clearly.
            usually if we have this:

            <form name=".." method="post" action="my.php" >
            <input type="Text" name="myname" id="myname" size="30"...<Br >
            <input type="submit" name".." value="save">
            </form>

            and my.php will have:

            <?php
            $myname=$_POST['myname'];
            .
            //processing here....
            .
            ?>

            now how about if i remove the <form...tag. then instead of a submit
            button ill replace it with a text linking to my.php. it loots
            something like this:

            <input type="Text" name="myname" id="myname" size="30"...<Br >
            <a href="my.php?na me='.$myname.'. ..>Save</a>

            then my.php will look like this:
            <?phpa
            $myname=$_GET['myname'];
            .
            //processing here....
            .
            ?>

            my problem is how get the value of the textbox and assign it to
            $myname variable.
            is it possible with php or i need javascript for this matter? i hope i
            was able to explain it clearly


            >
            Unless the textbox is in a form, it will never be submitted to the
            server, so PHP will never see it.
            >
            But why not use a form? That's why it's there.
            >
            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstucklex@attgl obal.net
            =============== ===
            Along the lines of what you were saying, you can use $_GET variables by
            formatting a web address link correctly

            http://www.domain.com/index.php?key1= 'value1'+key2=' value2'

            but a textarea form field is too large to do that with. If you already have
            a textarea that needs to be filled in, there's normally some submit button
            and would probably be simpler using $_POST variables than trying to force
            the textarea data in $_GET.

            Tom
            --
            Newsguy.com
            Unlimited Accounts - $19.95 / month


            Comment

            Working...