Jump to content

bit of help


supanoob

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
Link to comment
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 }
Link to comment
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]
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.