Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-20-2011, 11:02 PM   PM User | #1
Time Sheep
New Coder

 
Join Date: Sep 2011
Posts: 61
Thanks: 9
Thanked 1 Time in 1 Post
Time Sheep is an unknown quantity at this point
Form not setting "GET" value

I suppose the problem relates to HTML and not PHP however there is a tiny bit of PHP in the code which may have caused the problem:
PHP Code:
echo '<form action="index.php" method="get">';
echo 
'<select id="server">';
if(
$UserInfo->local_permissions == OR $UserInfo->admin_lvl >= 2){
    echo 
'<option>Sandbox</option>';
}
if(
$UserInfo->local_permissions == OR $UserInfo->admin_lvl >= 2){
    echo 
'<option>Fretta</option>';
}
echo 
'</select>&nbsp;';
echo 
'Day: <input type="text" id="day" maxlength="2" size="2" />&nbsp;';
echo 
'Month: <input type="text" id="month" maxlength="2" size="2" />&nbsp;';
echo 
'Year: <input type="text" id="year" maxlength="4" size="4" value="" />&nbsp;';
echo 
'<input type="hidden" id="page" value="logs" />';
echo 
'<input type="submit" value="Load" id="Load" /></form>'
What you see here is an ordinary form... It works fine, until you click "Load"...
What I think might be the sin here, is the fact that this piece of code is found on a page called "index.php?page=logs". When I press load it sends people to index.php as it's supposed to, but no data goes into the URL. This doesn't work with post either - and I really can't figure out what I've done wrong :S
At first I tried setting the form action to index.php?page=logs and then after that I tried with just index.php and then saving the page variable inside the form.
__________________
Need help?
I work with the following languages:
HTML: Professional - PHP: Professional - Visual C#: Average - CSS: Average - ASP: Please don't hurt me! ;(
Currently practicing: Visual C#

Last edited by Time Sheep; 12-21-2011 at 07:47 AM.. Reason: Problem solved
Time Sheep is offline   Reply With Quote
Old 12-20-2011, 11:38 PM   PM User | #2
Apothem
Regular Coder

 
Apothem's Avatar
 
Join Date: Mar 2008
Posts: 380
Thanks: 36
Thanked 25 Times in 25 Posts
Apothem is an unknown quantity at this point
You need a name for each form element. If there is no name, there is no key to associate the data to.

e.g.
Code:
<select id="server" name="server">
Apothem is offline   Reply With Quote
Users who have thanked Apothem for this post:
Time Sheep (12-21-2011)
Old 12-21-2011, 07:46 AM   PM User | #3
Time Sheep
New Coder

 
Join Date: Sep 2011
Posts: 61
Thanks: 9
Thanked 1 Time in 1 Post
Time Sheep is an unknown quantity at this point
Quote:
Originally Posted by Apothem View Post
You need a name for each form element. If there is no name, there is no key to associate the data to.

e.g.
Code:
<select id="server" name="server">
Oh... I thought id was a replacement for name...
Well, thanks then :P Wouldn't have figured that out myself
__________________
Need help?
I work with the following languages:
HTML: Professional - PHP: Professional - Visual C#: Average - CSS: Average - ASP: Please don't hurt me! ;(
Currently practicing: Visual C#
Time Sheep is offline   Reply With Quote
Reply

Bookmarks

Tags
data, forms, nodata, post

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:52 PM.


Advertisement
Log in to turn off these ads.