Jump to content

Archived

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

supanoob

bit of help

Recommended Posts

[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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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 }

Share this post


Link to post
Share on other sites
You can acheive this with JavaScript.

[code]
<script language='JavaScript' type='Text/javascript'>

var currentAction = 0
var 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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

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.