Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 11-09-2008, 02:59 PM Form Variables
Novice Talker

Posts: 11
Name: Alex
Trades: 0
Hi everyone,

I created a form using six drop down boxes to let people specify a time frame when pulling their data from my database (start year, start month, start day, end year, end month, end day). When people adjust their drop down menus and click submit, my page reloads, checks the variables for security, enters them into the MySQL query, and executes the query, and drops the data into the page.

It works well, but here's the problem:

When people load the page initially, no data appears. They have to click the submit button on my time frame form in order for the page to reload and data to appear.

It makes sense why this happens, but does anyone know how to get data to initially appear, such as year-to-date or all time data to show when they first visit the page?

Any suggestions would be great. Thanks!
pico204 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-09-2008, 03:59 PM Re: Form Variables
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
You are just going to have to create defulat values at the point where the form vars are processed.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 11-09-2008, 05:19 PM Re: Form Variables
Novice Talker

Posts: 11
Name: Alex
Trades: 0
Thanks, mgraphic.

I added this to my script:

Code:
if(!isset($_GET['syear'])) $syear = "2008"; 
else $syear = $_GET["syear"];
if(!isset($_GET['smonth'])) $smonth = "1"; 
else $smonth = $_GET["smonth"];
if(!isset($_GET['sday'])) $sday = "1"; 
else $sday = $_GET["sday"];
if(!isset($_GET['eyear'])) $eyear = "2009"; 
else $eyear = $_GET["eyear"];
if(!isset($_GET['emonth'])) $emonth = "1"; 
else $emonth = $_GET["emonth"];
if(!isset($_GET['eday'])) $eday = "1"; 
else $eday = $_GET["eday"];
It's designed to give a time frame between Jan 1, 2008 through Jan 1, 2009. But that's not working. I even echoed out my variables and saw it wasn't saving anything.

Am I doing something wrong?

Thanks again, everyone.

Last edited by pico204; 11-09-2008 at 05:26 PM.. Reason: Typo in the code
pico204 is offline
Reply With Quote
View Public Profile
 
Old 11-09-2008, 05:29 PM Re: Form Variables
Novice Talker

Posts: 11
Name: Alex
Trades: 0
Nevermind, figured it out... a piece of code earlier in my script was clearing the variable values.

For people who visit this post in the future, the above code DOES work.
pico204 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Form Variables
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13119 seconds with 12 queries