cleary1981 Posted July 29, 2008 Share Posted July 29, 2008 I need to set a php variable to the same value as this line of php so I can pass it to the next page. How do I go about it? <input type = "text" value = "" disabled name = "proj_id_edit" id = "proj_id_edit" onChange="setProject"></td> $p_id = proj_id_edit.value Quote Link to comment https://forums.phpfreaks.com/topic/117125-solved-get-php-variable-fom-html/ Share on other sites More sharing options...
JonnoTheDev Posted July 29, 2008 Share Posted July 29, 2008 If the form method is POST: $p_id = $_POST['proj_id_edit']; If the form method is GET: $p_id = $_GET['proj_id_edit']; Quote Link to comment https://forums.phpfreaks.com/topic/117125-solved-get-php-variable-fom-html/#findComment-602424 Share on other sites More sharing options...
ignace Posted July 29, 2008 Share Posted July 29, 2008 using GET or POST GET: you can pass it in the url or through a form url: <a href="page.php?argument=value"> .. form: <form action="page.php" method="get"><input type="hidden" name="argument" value="value" /> POST: only through a form <form method="post"><input type="hidden" name="argument" value="value" /> type="hidden" does not necessarily be hidden, it also can be text, password, .. download a html reference XHTML 1.0 by preference Quote Link to comment https://forums.phpfreaks.com/topic/117125-solved-get-php-variable-fom-html/#findComment-602426 Share on other sites More sharing options...
cleary1981 Posted July 29, 2008 Author Share Posted July 29, 2008 i have tried it using url but whats wrong with my code <table width=100% border=0> <tr> <td><label for="proj_id_edit">Project ID</label> <input type = "text" value = "" disabled name = "proj_id_edit" id = "proj_id_edit" onChange="setProject"></td> <td><label for="projName_edit">Project Name</label> <input type = "text" value = "" disabled name = "projName_edit" id = "projName_edit"></td></tr> <tr><td><label for="comp_edit">Company Name</label> <input type = "text" value = "" disabled name = "comp_edit" id = "comp_edit"></td> <td><label for="access_edit">Access</label> <input type = "text" value = "" name = "access_edit" id = "access_edit"></td></tr> <tr><td><label for="cable_edit">Cable Entry</label> <input type = "text" value = "" name = "cable_edit" id = "cable_edit"></td> <td><label for="ip_edit">IP Rating</label> <input type = "text" value = "" name = "ip_edit" id = "ip_edit"></td></tr> <tr><td><label for="fault_edit">Fault Rating</label> <input type = "text" value = "" name = "fault_edit" id = "fault_edit"><span>KW/sec</span></td> <td><label for="iform_edit">Form</label> <input type = "text" value = "" name = "iform_edit" id = "iform_edit"></td></tr> <tr><td><label for="pman_edit">Project Manager</label> <input type = "text" value = "" name = "pman_edit" id = "pman_edit"></td> <td><label for="deadline_edit">Tender Deadline</label> <input type = "text" value = "" name = "deadline_edit" id = "deadline_edit"></td> </tr> <tr><td><input type="button" value="Update" name="update" onClick="updateProjectDetails()"> <div id="xx"></div></td></tr></table> </fieldset> <fieldset> <legend>4. Proceed to Design Mode</legend> <input type="button" value="Design Mode" onClick = "window.open('designmode.php?p_id = {document.getElementById("proj_id_edit").value}', '', 'width=1280, height=700, resizable=yes, statusbar=yes')"> </fieldset> Quote Link to comment https://forums.phpfreaks.com/topic/117125-solved-get-php-variable-fom-html/#findComment-602446 Share on other sites More sharing options...
JonnoTheDev Posted July 29, 2008 Share Posted July 29, 2008 Too much Javascript setting values Quote Link to comment https://forums.phpfreaks.com/topic/117125-solved-get-php-variable-fom-html/#findComment-602452 Share on other sites More sharing options...
cleary1981 Posted July 29, 2008 Author Share Posted July 29, 2008 what do you mean by this? Where are you talking about? Quote Link to comment https://forums.phpfreaks.com/topic/117125-solved-get-php-variable-fom-html/#findComment-602462 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.