get value of form element in same page

  • dheerhot
  • Novice
  • Novice
  • User avatar
  • Posts: 34

Post 3+ Months Ago

hello again, normally we used to post values of form elements to other page or in database, but here i want to collect its value in the same page without submitting the form, like happens in java script, by using getElementById() method..

Same thing i want to do in php ..

suppose i hve below form say test1.php...

Code: [ Select ]
<form name="test" method="post" action="">
<input type="text" name"t1" id="t1" value="">
<select name="s1"><option value="cricket">Cricket</option>
<option value="football">Football</option>
<input type="submit" name"sub1">
  1. <form name="test" method="post" action="">
  2. <input type="text" name"t1" id="t1" value="">
  3. <select name="s1"><option value="cricket">Cricket</option>
  4. <option value="football">Football</option>
  5. </select>
  6. <input type="submit" name"sub1">
  7. </form>

now i want to get the values of textfield & combo box in the same page i.e. test1.php, without submitting the form...
  • joebert
  • Genius
  • Genius
  • User avatar
  • Posts: 13511
  • Loc: Florida

Post 3+ Months Ago

Be a little more specific about what your over-all goal is please.
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8485
  • Loc: USA

Post 3+ Months Ago

You'll have to submit the form... except the action would lead to it's own page and it would print the values accordingly... otherwise, you can use JavaScript associated with PHP to accomplish what you want.

You can use the JavaScript to print the values from the Form to the screen, and the PHP to process the information. I can't help you hear as I just started to learn JavaScript but someone else could tell you how to do this.

@joebert: He basically wants the information to be processed on the same page... and I assume he wants it done without the page refreshing...

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 36 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.