Jump to content


Photo

bit of help


  • Please log in to reply
6 replies to this topic

#1 supanoob

supanoob
  • Members
  • PipPipPip
  • Advanced Member
  • 342 posts

Posted 06 July 2006 - 02:08 PM

<?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>

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

#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 06 July 2006 - 02:14 PM

you want what link to change to 1/2 ? the only link i see in that script is an image link that has no apparent numbering system...
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 supanoob

supanoob
  • Members
  • PipPipPip
  • Advanced Member
  • 342 posts

Posted 06 July 2006 - 02:15 PM

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

#4 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 06 July 2006 - 02:26 PM

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 }
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#5 supanoob

supanoob
  • Members
  • PipPipPip
  • Advanced Member
  • 342 posts

Posted 06 July 2006 - 02:30 PM

yeah thanks, i honestly didnt think of that :( *feels slightly dumb*

#6 CheesierAngel

CheesierAngel
  • Members
  • PipPipPip
  • Advanced Member
  • 105 posts
  • LocationBelgium

Posted 06 July 2006 - 02:32 PM

You can acheive this with JavaScript.

<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>


#7 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 06 July 2006 - 02:56 PM

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 were to use javascript, and it did 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.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users