Jump to content

[SOLVED] document.getElementById problem


robert_gsfame

Recommended Posts

i don't have any idea at all about javascript but i need it so much, can anyone help me?

 

I would like to have 2 buttons in one form,

first button will be used to execute this <form action=page1.php>

while the second button i will use to jump and execute whatever script written in page2.php

 

I know that i need to use getElementById....but i don't know how to do it, and how to pass the value into page2.php...let say

 

i have $id=$_GET['id']; then i want to pass this to page2.php, how can i do it using JS.

 

detail explanation would help a lot, thx in advance

Link to comment
https://forums.phpfreaks.com/topic/175800-solved-documentgetelementbyid-problem/
Share on other sites

okay i got what i want...i don't know whether this is correct or not but it works

 

$id=$_GET['id'];

<script type="text/javascript" language="javascript">

  function _func1(){

    parameter = document.getElementById("value1").value

 

window.location="page1.php?id=<?php echo $id;?>&myparameter=" + parameter;}

</script>

 

<input type="text" id="value1">

<input type=button onclick=_func1()>

 

Is something missing ?? or this is correct?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.