daddyb1 Posted October 29, 2011 Share Posted October 29, 2011 I have a menu that i want to be added to every page of my coding using a hidden variable, but i cannot get it to work. I using this with a few if conditions. the index page should navigate every page. can anyone help? I have attached the files to illustrate the coding i have done so far. [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted October 29, 2011 Share Posted October 29, 2011 can you post the code on here please. Quote Link to comment Share on other sites More sharing options...
daddyb1 Posted October 29, 2011 Author Share Posted October 29, 2011 the files are in the zip folder. i attached Quote Link to comment Share on other sites More sharing options...
Psycho Posted October 29, 2011 Share Posted October 29, 2011 You shouldn't expect us to sift through your files trying to find the problem. You need to post the relevant code and explain what variable is specific to the problem and show how it is used. Quote Link to comment Share on other sites More sharing options...
daddyb1 Posted October 29, 2011 Author Share Posted October 29, 2011 -----index page----- <?php $state=$_GET["state"];?> <?php $page=$_GET["page"];?> <html><head><title>CONTROLLER</title><?php include("styles.inc"); ?></head> <body><div style="position:absolute; top: 1px; left: 1px;"><?php include("dynamicmenu.inc");?></div> <div style="position:absolute; top:15px; left: 140px;"> <?php if ($state == NULL { include("default.inc"); } //DEFAULT PAGE INCL else if ($state=="1") { include("problem1.inc"); if($page=='1' || $page == NULL) {include("problem1.php");} if( $page=='2') { include ("problem1s2.php"); } if( $page=='3') { include ("problem13y.php"); } if( $page=='4') { include ("problem13j.php"); } } else if ($state=="2") { include("problemm2.inc"); include("problem2.inc"); } //PROBLEM2 PAGE INCLUDE ?> </div> </body> </html> ----problem1.php <?php echo' <input type="hidden" name="page" value="1" /> <input type="hidden" name="state" value="1" />'; echo '<form action="index.php?page=2" method="get"> Enter Coupon State: <select name="coupon"><option></option><option>NJ</option> <option>NY</option></select> <input type="submit" value="ENTER"/> </form>'; ?> ----problem1s2 <?php echo' <input type="hidden" name="state" value="1" /> <input type="hidden" name="page" value="2" /> '; $coupon=$_GET["coupon"]; if($coupon=="NJ") { echo "<form action='index.php?page=3' method='get'>"; echo "<input type='hidden' name='days' value='5'/>"; } else if($coupon=="NY") { echo "<form action='index.php?page=4' method='get'>"; echo "<input type='hidden' name='days' value='1'/>"; } else { echo "<form action='index.php?state=1' method='get'>"; } echo"ENTER ZIPCODE LAST 2-DIGITS : <input type='text' name='code'>"; echo'<input type="submit" value="NEXT STEP"/> ?> ------problem 13y.php <?php echo' <input type="hidden" name="state" value="1" /> <input type="hidden" name="page" value="3" />'; $days=$_GET["days"]; $code=$_GET["code"]; $code2=(int)$code%(int)$days; if($code2<=2) { echo "FINAL OUTPUT:B$days$code2";} else { echo "FINAL OUTPUT:D$code2$days";} echo "<a href='index.php?state=1'>restart</a>"; ?> ----problem13j.php <?php echo'<input type="hidden" name="state" value="1" /> <input type="hidden" name="page" value="4" /> '; $days=$_GET["days"]; $code=$_GET["code"]; $code=10%(int)$code; if($code<=1) { echo "FINAL OUTPUT:A$days$code";} else { echo "FINAL OUTPUT:C$code$days";} echo'<br /><a href="index.php?state=1">restart</a>'; ?> Quote Link to comment Share on other sites More sharing options...
daddyb1 Posted October 29, 2011 Author Share Posted October 29, 2011 not sure where i am going wrong Quote Link to comment Share on other sites More sharing options...
daddyb1 Posted October 29, 2011 Author Share Posted October 29, 2011 how do i pass the hidden variables? Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted October 29, 2011 Share Posted October 29, 2011 what do you mean "hidden variable"? Quote Link to comment Share on other sites More sharing options...
daddyb1 Posted October 29, 2011 Author Share Posted October 29, 2011 <input type="hidden" name="page" value="1" /> <input type="hidden" name="state" value="1" /> <input type="hidden" name="page" value="2" /> <input type="hidden" name="state" value="1" /> <input type="hidden" name="page" value="3" /> <input type="hidden" name="state" value="1" /> <input type="hidden" name="page" value="4" /> <input type="hidden" name="state" value="1" /> i want these to identify each page that will be included in the index page. each page will be added to the index page based on the if conditions. its not working. is there another way to do it? Quote Link to comment Share on other sites More sharing options...
daddyb1 Posted October 29, 2011 Author Share Posted October 29, 2011 i want each page to be included in the index page when the condition i have written is met, but i am trying to read each pagee with a unique hidden variable such as : <input type="hidden" name="state" value="1" /><input type="hidden" name="page" value="1" /> etc but i am not coding it correctly. does this explain what i am trying to do? Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted October 29, 2011 Share Posted October 29, 2011 No one has helped you because we're not entirely sure what you're trying to do. The code snippet you've provided is essentially gibberish. Suffice it to say that hidden form values won't be read until they're submitted to your script. Merely include-ing them won't work as your if-conditionals won't 'see' them. Ultimately, given how fundamental form handling and includes are, your best bet is to brush up on PHP basics. I'm getting the distinct feeling you're trying to run before you can even crawl, and that's the path of disappointment and failure. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.