supanoob Posted July 6, 2006 Share Posted July 6, 2006 [code]<?php session_start();require_once('dbconnect.php');?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title>Index - Past Issues</title> </head><body bgcolor="black" TEXT="silver" LINK="white" VLINK="white" ALINK="######"><center><a name="top"><img src=http://img455.imageshack.us/img455/6946/ktherald5rd.jpg></a></center>Please enter the username and password under the issue number you are subscribed to and wish to view. If you are not subscribed mail ArchAngel (ID 2735) to get subscribed.<br><center> <form method="POST" action="<?php echo "issue.php?view_issue=$issue"; ?>"><span lang="en-gb">Issue Number: <select size="1" name="issue"> <option selected>1</option> <option>2</option> </select> </span><br><span lang="en-gb">username: </span><input type="text" size="25" maxlength="256" name="naname"> <span lang="en-gb">Pass: </span><input type="password" size="25" maxlength="256" name="password"><input type="submit" value="Submit"> </a></form></center> </body></html>[/code]what i need to happen is i want the link to change to 1 when i select 1 an 2 when i select 2 etc but i dont know how to do it :(any help is appreciated Quote Link to comment https://forums.phpfreaks.com/topic/13844-bit-of-help/ Share on other sites More sharing options...
.josh Posted July 6, 2006 Share Posted July 6, 2006 you want [i]what[/i] link to change to 1/2 ? the only link i see in that script is an image link that has no apparent numbering system... Quote Link to comment https://forums.phpfreaks.com/topic/13844-bit-of-help/#findComment-53873 Share on other sites More sharing options...
supanoob Posted July 6, 2006 Author Share Posted July 6, 2006 sorry i meant action what it has<form method="POST" action="<?php echo "issue.php?view_issue=$issue"; ?>">i want the end to change to whatever i select using the drop down box Quote Link to comment https://forums.phpfreaks.com/topic/13844-bit-of-help/#findComment-53877 Share on other sites More sharing options...
.josh Posted July 6, 2006 Share Posted July 6, 2006 so let me get this straight: you want issue.php?view_issue=$issue to change to view_issue=1 when the user selects 1 and view_issue=2 if the user select 2, so that when the user clicks submit, it submits based on that? you cannot do that with php. you would have to do that with javascript. altough i would have to ask you why you wish to do this? just base your process script on the drop down variable itself, just like you'd want it to do with the action url anyways. example: if($_POST['issue'] == '1') { //do whatever } Quote Link to comment https://forums.phpfreaks.com/topic/13844-bit-of-help/#findComment-53884 Share on other sites More sharing options...
supanoob Posted July 6, 2006 Author Share Posted July 6, 2006 yeah thanks, i honestly didnt think of that :( *feels slightly dumb* Quote Link to comment https://forums.phpfreaks.com/topic/13844-bit-of-help/#findComment-53885 Share on other sites More sharing options...
CheesierAngel Posted July 6, 2006 Share Posted July 6, 2006 You can acheive this with JavaScript.[code]<script language='JavaScript' type='Text/javascript'>var currentAction = 0var action = new Array()action[0] = 'issue.php?view_issue=1'action[1] = 'issue.php?view_issue=2'function flipAction() { currentAction = 1 - currentAction document.getElementById("actions".innerHTML = action[currentAction]}</script><div id="actions">issue.php?view_issue=1</div>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/13844-bit-of-help/#findComment-53887 Share on other sites More sharing options...
.josh Posted July 6, 2006 Share Posted July 6, 2006 well the problem with the javascript solution is that if the user has javascript disabled his code will not function. and also, even if he [i]were[/i] to use javascript, and it [i]did[/i] work, he'd still have to retrieve the value with $_GET, which if you think about it, is kind of pointless. I mean, why try to pass the value through another method if it is going to be posted anyways. and on top of that, using that js method that passes the value through the url, i could easily type in issue.php?view_issue=whateveriwantthistobe so he would have to do even more security checks on top of everything else. Quote Link to comment https://forums.phpfreaks.com/topic/13844-bit-of-help/#findComment-53895 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.