Jump to content

Insert session variable into form


sporks

Recommended Posts

I've set a session variable that spits out the ID of the previous page.  There is a hidden field on my insert form which I've set to equal the session variable.  I have the variable echoing so I know it works but if you insert the form, the field shows up as null.  What is wrong with my field?

 

<input type="hidden" name="pastID" value="<?php $_SESSION['fromID'] ?>" />
  <input type="hidden" name="MM_insert" value="form1" />

 

Also I have a repeating region spitting out text and I wanted to place the word 'or' between each one.  Is there a way I can put something in between a repeating region without it that something also on the end.

 

ie NOT: 'field one' or 'field two' or

Link to comment
https://forums.phpfreaks.com/topic/103517-insert-session-variable-into-form/
Share on other sites

If you are using a while loop you could do something like this:

<?php
$x = 0
while (what ever your condition is)
{
if ($x != "0")
{
echo "or";
}

//your repeating title code here

$x++;
}
?>

 

This will place 'or' before every title except when $x is equal to 0 which is only on the first loop so no 'or' will appear before the first title.

Note: You can do this with any loop, I just used while as an example.

 

I hope that solved all your problems  ;)

Archived

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

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