So for checkbox:
Apple = checked
Mango = checked
My html code:
Here is a picture of what it looks like:
Again, I want the value of what is actually checked to display in a new page/form.
Thanks and sorry if I am not clear!
Results 1 to 8 of 8
You mentioned PHP, so I’m assuming you’re on a server running PHP and your dev environment is ready to go!
Basically, web apps send data between pages by the URL/Querystring which you’ll see as some_page.php?key=value (which can be done using the form method GET, or manually constructing the query string, etc.), or by a POST (like your current FORM).
Then the “receiving” page just needs to access those values. In PHP, this is done through the $_GET and $_POST variables.
If you POST your form, you’ll need to indicate the page that will handle the POST processing, so let’s say the page you posted is form_main.php (or .htm since it doesn’t actually contain any server script). You’ll just want to change the FORM section to something like this:
Last edited by [DT]; 05-25-2012 at 15:33."Remember, you're young only once but you can be immature forever."
ex nihilo7 likes this post
Dude...Sweet! Thanks! I'm going to try this right now!
The Checkbox doesn’t “exist” in the POST unless it’s checked
edit: I got the non-array examples to work! It took me about 10 minutes to realize I was trying to run the form outside of my localhost server. I was like "why is echo not working!"
I'm going to try the array next.
edit2: I got the array working correctly! The only error is that when I don't select anything in the array, it gives me an error saying "undefined index". It must not know how to handle 0 selections.
here is a screenshot of it:
Last edited by ex nihilo7; 05-25-2012 at 23:38.PS4|PS3|PS2|PS1|PSVITA|XBOX 360|XBOX|N64|3DS XL|DSi|Gameboy Advance|Gameboy Color|PC
[DT] or anyone else, do you know how to strip the html from a php array on the fly for use when sending an html email?
$N = count($ends);
echo ('<table border="1" class="lines" width="100%">');
echo ("<tr><th>Look For</th>");
echo ("<th>Observed Comments</th></tr>");
for($i=0; $i < $N; $i++)
echo($ends[$i] . "<p>");
echo (" ");
PS4|PS3|PS2|PS1|PSVITA|XBOX 360|XBOX|N64|3DS XL|DSi|Gameboy Advance|Gameboy Color|PC
Yep, there’s a function built right into PHP:
returns a string with the tags removed ($string is the input string).
$str = '
this is some markup';
this is some markup
"Remember, you're young only once but you can be immature forever."
I tried this:
$message = join($_POST['group1']).join($_POST['group2']).join($_POST['group3']);
and it prints out the correct strings from my arrays in this fashion:
string, string, string,etc.
string string string string string stringPS4|PS3|PS2|PS1|PSVITA|XBOX 360|XBOX|N64|3DS XL|DSi|Gameboy Advance|Gameboy Color|PC
OK, cool, I was going to mention that the underlying tag parser could/can occasionally get frazzled if the markup isn’t to spec."Remember, you're young only once but you can be immature forever."
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)