Dont reply right away. Read all the links I have provided before. Then apply your newfound knowledge to your scripts.
Marco van Wijngaarden wrote:Code: Select all
<form name="data" method="post" action="step3.php">
<?php
session_start();
$klantgegevens = array(
"bedrijf" => $bedrijf,
"naam" => $naam,
);
?>
<P>regel1<input type="text" name="regel1"></P>
<P>regel2<input type="text" name="regel2"></P>
<input type="submit" name="Submit" value="To step 3">
</FORM>
I have mentioned you must start the session before any output. Why don't you?
Marco van Wijngaarden wrote:
but when i want to print a single value from an array such as above $klantgegevens, how should i write my code? I understand that this won't work in my version:
Code: Select all
print ("{$_SESSION[klantgegevens][bedrijf]}<BR>\n");
also.... if i want to fill a hidden field, how will i get this to work:
Code: Select all
<?php
session_start();
?>
<input type="hidden" name="bedrijf" value="<?php echo $_POSTї'klantgegevens']ї'bedrijf']?>">
NOTE: that should be [questionmark][greater then]
for your information, this last hiddenfield will be needed for a "liveconnect" to a flash file (sending variables to flash)
It is OK to fill in the hidden field like that, just be sure to start the <form> first so it surrounds the hidden field.
There are
tree reasons to why the above does not work:
1 you didn't start the session before output.
2 the $_SESSION array doesn't exist in your version of PHP
3 the $_POST array doesn't exist in your version of PHP
Checklist:
* In version 4.0.6 the $_SESSION and $_POST didn't exist. Instead there were $HTTP_SESSION VARS and $HTTP_POST VARS. If register globals is on, you don't have to use them. Still I encourage you to do things without register_globals. Check the ONLINE manual why, because the online manual has comments that might help in certain situations.
* start session before any output.
* when you do
Code: Select all
<?php
print("Variable from an array {$arr['textindex']}");
?>
it shouldn't be
Code: Select all
<?php
print("Variable from an array {$arr[textindex]}");
?>
If you still dont get it, read again SLOWLY. Don't skim! programmers must not skim! you need to discover every little ' or . or , or ;