Jump to content

saco

Members
  • Posts

    4
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

saco's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, just to say that I resolved the problem. I was checking local variables instead of session variables. Thanks for your help!
  2. Hi, I should have included this with my initial post, but I now have a similar problem with radio buttons, I need the values to be retained after leaving and returning to the form (sticky radio buttons), the values are then referenced using session variables and emailed to me when the form is complete. The text field aspect is working fine. Any help would be greatly appreciated. Here is the code : <?php session_start(); $_SESSION['otherchoice'] = (isset($_POST['choice']) ? $_POST['choice'] : (isset($_SESSION['otherchoice']) ? $_SESSION['otherchoice'] : '')); //radio $_SESSION['textchoice'] = (isset($_POST['txt']) ? $_POST['txt'] : (isset($_SESSION['textchoice']) ? $_SESSION['textchoice'] : '')); //text //$_SESSION['otherchoice'] = $_POST['choice']; //radio //$_SESSION['textchoice'] = $_POST['txt']; //text $OC = ''; if(isset($_POST['submit'])) { //process the radio buttons if(isset($_POST['choice'])) $OC = $_POST['choice']; else $OC = false; if($OC == 'yes' && ($_SESSION['textchoice'] == '')) $OC = false; else $OC = $_POST['choice']; //echo '<p>Other Choice<br />'; //if all entries okay, process information, display message and exit script. if($OC) { header("Location: success2.php"); } } ?> <html> <head> <title>Page 3</title> <head> <script type="text/javascript"> function make_blank() { document.theform.txt.value =""; } </script> <script type="text/javascript"> function make_blank2() { document.theform.txt2.value =""; } </script> </head> <body> <?php echo '<h2>Page 3</h2>'; echo '<form name="theform" action="' . $_SERVER['PHP_SELF'] . '" method="POST">'; if(isset($_POST['submit']) && !$OC) echo '<p><font color="red" size="+1"><b>Please Specify</b></font><br />'; else echo '<p>What colour would you like? [required]<br />'; if($OC == 'red') echo '<input type="radio" name="choice" value="red" checked onClick="make_blank();this.form.txt.disabled=true;"/>red <br />'; else echo '<input type="radio" name="choice" value="red" onClick="make_blank();this.form.txt.disabled=true;"/>red <br />'; if($OC == 'green') echo '<input type="radio" name="choice" value="green" checked onClick="make_blank();this.form.txt.disabled=true;"/>green <br />'; else echo '<input type="radio" name="choice" value="green" onClick="make_blank();this.form.txt.disabled=true;"/>green <br />'; if($OC == 'orange'){ echo '<input type="radio" name="choice" value="orange" checked onClick="make_blank();this.form.txt.disabled=true;"/>orange <br />'; }else{ echo '<input type="radio" name="choice" value="orange" onClick="make_blank();this.form.txt.disabled=true;"/>orange <br />'; } if($OC == 'other') echo '<input type="radio" name="choice" value="other" onClick="this.form.txt.disabled=false;this.form.txt.focus()"checked />Other...Please specify '; else echo '<input type="radio" name="choice" value="other" onClick="this.form.txt.disabled=false;this.form.txt.focus();"/>Other...Please specify '; echo '<input disabled type="text" name="txt" value="' . $_SESSION['textchoice'] .'" />'; echo '<p><input type="submit" name="submit" value="submit"></p>'; echo '</form>'; echo '</body>'; echo '</html>'; ?> and success2.php is : <?php session_start(); echo 'What colour would you like? : '; if ($_SESSION['otherchoice'] == "other"){ echo "other"; echo "<br>"; echo 'Other information is : '; echo $_SESSION['textchoice']; echo "<br>";} else { echo $_SESSION['otherchoice']; echo "<br>";} ?> thank you!
  3. Hi!, this is the problem I am having: echo("<tr><td><a href=http://www.test.com/$item_name.htm>Download</a></td></tr>"); $item_name is the variable, and I need to put the file extension after the variable. the reply is http://www.test.com/.htm thanks very much! - sorry, disregard last post Saco
  4. Hi! I am having problems inserting variables into h ref. how do I do it?
×
×
  • 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.