paulman888888 Posted April 12, 2009 Share Posted April 12, 2009 I am a happy at PHP but i wanted to start learning JavaScript so after reading off w3 i started to make a link using a form. here is what is out puted after PHP. I decide not to show you the PHP incase you dont do it. Heres the javascript line <a href="#" onclick="window.location.href='?page=Packages&id'+Form.request.package;"> View Package Details </a> What i tryed doing is making JavaScript Take the user to a new page but useing a bit of information selected by the user from a drop down menu form. <form id="request" method="POST" action="index.php?page=Request"><br /> <input id="name" style='width:70%;' name="name" type="text" maxlength="50" value="Name" /><br /> <input id="email" style='width:70%;' name="email" type="text" maxlength="250" value="Email Address" /><br /><select name="package"><option value=" ">Guru</option><option value=" ">Starter</option><option value=" ">Advance</option><option value=" ">Master</option><option value=" ">Basic</option></select><a href="#" onclick="window.location.href='?page=Packages&id'+Form.request.package;"> View Package Details </a><br /><textarea id="msg" style='width:90%; height:200px' name="msg">Please Enter Your Plan Here Including what feature you want, like; Guessbooks, Forums, Upload area, Members area and ect.</textarea><br /> <input id="Submit" type="submit" name="Submit" value="Submit" /></form> Please help me my this link work. Thankyou for any help Paul Quote Link to comment Share on other sites More sharing options...
Axeia Posted April 12, 2009 Share Posted April 12, 2009 Don't see anything wrong with it, try it in firefox and paste whatever the error console comes up with here please. Quote Link to comment Share on other sites More sharing options...
jackpf Posted April 12, 2009 Share Posted April 12, 2009 Don't you want document.form.request.package.value rather than form.request.package? Forgive me if I am incorrect. Quote Link to comment Share on other sites More sharing options...
.josh Posted April 13, 2009 Share Posted April 13, 2009 Don't you want document.form.request.package.value rather than form.request.package? Forgive me if I am incorrect. QFT. also you forgot the = in the variable=value for the id param Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted April 13, 2009 Author Share Posted April 13, 2009 Thankyou for the help but it still is not working. Heres the firefox error console; Error: Document.Form is undefined Source File: http://testing.hidden address.com/index.php?page=Request# Line: 1 Heres the update javascript code with PHP removed. <a onclick="window.location.href='index.php?page=Packages&id='+Document.Form.request.package.value;" href="#"> View Package Details </a> Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted April 13, 2009 Author Share Posted April 13, 2009 Thankyou all again. With your help i fixed it. <a onclick="window.location.href='index.php?page=Packages&id='+request.package.selectedIndex;" href="#"> View Package Details </a> The reason it didn't work was because i used .value a the end but its not a text field so it didn't work. i had to use .selectedIndex and remove the stuff before. it Thankyou again Paul Quote Link to comment 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.