SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2006
    Location
    Sydney, Australia
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Left menu, right form display

    I have a standard html/css page that displays a top horizontal menu, and a left vertical menu.

    When I select an option from the left menu it's calling a php program that loads a template (basically a form for each option).

    My problem is I want to display the form to the right of the existing vertical menu and below the horizontal menu. Currently it displays like a new page, and a look at the page source shows the form detials without the rest of the calling page!

    What do I need to do? I probably haven't explained this very well
    www.scaryminds.com ScaryMinds - horror's last colonial outpost.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,195
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Hi Salient. It's not really clear what your situation is, so any further explanation you can give would be helpful.

    If this is just a positioning issue, please post the generated HTML and the CSS that goes with it so we can help you with positioning. If it's a PHP issue, we can move the thread to that forum.

  3. #3
    SitePoint Zealot
    Join Date
    Aug 2006
    Location
    Sydney, Australia
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ralph think it's an html issue or maybe css.

    Okay step by step going down the files, and cutting down to the relevant lines

    1. Admin.php

    Code:
    <?php
    
    include_once("./template/admin_head.html");
    
    ?>
    
    ...
    
    						<li><a href="admin_country.php?mod=cadd">Add a Country</a></li>
    In the admin_head.html we load the <head> section of the html, including css and js etc.

    A menu exists on the left hand side of the pafe with one of the options being "Add a Country". Okay that displays fine

    2. admin_country.php

    Code:
    	function countryadd()
    	{
    		global $templates, $admin_lang;
    		include($templates."admin_new_country.php");
    		exit();
    	}
    We drop into the countryadd function, in next version will be a class, that basically loads the "admin_new_country.php" template where we enter Country details.

    3. admin_new_country.php

    Code:
    	<form method="post" action="admin_country.php?mod=newcountry">
    		<p><?php echo($admin_lang['ctydetails']); ?></p>
    		<ol>
    	       	<li>
            		<label for="countryid"><?php echo($admin_lang['ctyid']); ?></label>
            		<input type="text" name="countryid" id="countryid" />
            	</li>
            	<li>
            		<label for="countryname"><?php echo($admin_lang['ctyname']); ?></label>
            		<input type="text" name="countryname" id="countryname" />
            	</li>
            	<li>
            		<label for="cgraphic"><?php echo($admin_lang['ctyupflag']); ?></label>
    				<input type="file" name="cgraphic" id="cgraphic" class="file" />
    			</li>
            	<li>
            		<button type="submit" id="save"><?php echo($admin_lang['ctyadd']); ?></button>
            	</li>
    	    </ol>
    	</form>
    When I look at page source I get the template html and nothing else So basically it's losing the css and previous html, almost like it's creating a fresh page. Think I'm missing something here, but not sure what.

    Have checked google but either am not entering the correct search criteria or this isn't a common occurance

    Strangely it's finding the language includes and translating those.
    www.scaryminds.com ScaryMinds - horror's last colonial outpost.

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,195
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Sorry, but all this is over my head. Everything you've posted above is just PHP stuff, and doesn't show what's actually happening on your page once it reaches the browser. (All PHP gets stripped out on the server, before the page is sent to the browser.)

    Quote Originally Posted by Salient View Post
    We drop into the countryadd function
    Not sure what that means.

    Again, if this is an HTML/ CSS issue, please post the page as it's seen by the browser, with the full HTML and CSS. That way we can assess any layout issues. If, instead, this is an issue of functionality, then your really need to be over in the PHP or WordPress forums.

  5. #5
    SitePoint Zealot
    Join Date
    Aug 2006
    Location
    Sydney, Australia
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looking at page source we get

    Code:
    <!--
    	Template  :	admin_country.php
    	Date      : 22 May 2011
    	Author    : Jeff (R version)
    	Version   : 1.0.1
    -->
    
    	<form method="post" action="admin_country.php?mod=newcountry">
    		<p>Country Details</p>
    		<ol>
    	       	<li>
            		<label for="countryid">Country Id</label>
            		<input type="text" name="countryid" id="countryid" />
            	</li>
    
            	<li>
            		<label for="countryname">Country Name</label>
            		<input type="text" name="countryname" id="countryname" />
            	</li>
            	<li>
            		<label for="cgraphic">Upload a Flag</label>
    				<input type="file" name="cgraphic" id="cgraphic" class="file" />
    			</li>
    
            	<li>
            		<button type="submit" id="save">Add the Country</button>
            	</li>
    	    </ol>
    	</form>

    Basically we are getting the template displayed with the language translates (via php echos) having been done.

    I'm wondering if because our main page has the page ending tags (</body> </html>), the browser is displaying that and then sees the template as a separate page when I click through onto it? Might explain the situation.

    This may require the whole page to be re-generate on each option click? We could do this with includes easily enough, but it kind of defeats the purpose somewhat
    www.scaryminds.com ScaryMinds - horror's last colonial outpost.

  6. #6
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,195
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    [This is really sounding like a PHP (functionality) question, so I've moved this thread to the PHP forum. ]

  7. #7
    SitePoint Zealot
    Join Date
    Aug 2006
    Location
    Sydney, Australia
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    [This is really sounding like a PHP (functionality) question, so I've moved this thread to the PHP forum. ]
    Uhmm no it's an html question, now know what the problem is, trying to sort a solution that doesn't involve a complete rebuild of the page from scratch
    www.scaryminds.com ScaryMinds - horror's last colonial outpost.

  8. #8
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,363
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    I think it's a php question (Bear in mind I know no php)

    When you submit your form you are requesting a new page and that's what you get.
    Code:
    <form method="post" action="admin_country.php?mod=newcountry">
    You ask for admin_country.php and that's what you get. You didn't ask for the original page with admin_country.php inserted into the middle.

    What I guess you should be doing (and I know no PHP as I said above) is requesting the original page again but modifying it with the results from the form submission so that your new data is visible.

    However it seems that perhaps some sort of ajax request would be more suitable.

    Hopefully one of the PHP experts will see this thread and advise the best way to do this.

  9. #9
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    71 Post(s)
    Tagged
    0 Thread(s)
    Need to see more of admin_country.php - specifically, where it looks for $_GET['mod'], and what it does with it (probably a switch statement)

  10. #10
    SitePoint Zealot
    Join Date
    Aug 2006
    Location
    Sydney, Australia
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by StarLion View Post
    Need to see more of admin_country.php - specifically, where it looks for $_GET['mod'], and what it does with it (probably a switch statement)
    As requested

    Code:
    	if(isset($_GET['mod']))
    	{
    		$mod = $_GET['mod'];
    	} else {
    		$mod = '';
    	}
    	
    	if(isset($_GET['id']))
    	{
    		$id = $_GET['id'];
    	} else {
    		$id = '';
    	}
    	
    	switch($mod)
    	{
    		case 'cadd':
    			countryadd();
    			break;	
    		case 'newcountry':
    			countrywrite();
    			break;
    		case 'del':
    			countrydel();
    			break;
    		case 'edit':
    			countryedit();
    			break;
    		case 'mod':
    			countrymod();
    			break;
    		default:
    			showall();
    			break;
    	}
    As Paul has pointed out above it's a request of a new page that is causing us an issue. The removal of all php from the scripts and a simple test with html elicits the same issue

    So I guess the question becomes, how to keep the original page and insert the form somehow, or do I need to redisplay the entire page with the form html included?
    www.scaryminds.com ScaryMinds - horror's last colonial outpost.

  11. #11
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    71 Post(s)
    Tagged
    0 Thread(s)
    2. admin_country.php

    Code:
    	function countryadd()
    	{
    		global $templates, $admin_lang;
    		include($templates."admin_new_country.php");
    		exit();
    	}

    <form method="post" action="admin_country.php?mod=newcountry">

    case 'newcountry':
    countrywrite();
    break;

    you're looking in the wrong function.

  12. #12
    SitePoint Zealot
    Join Date
    Aug 2006
    Location
    Sydney, Australia
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by StarLion View Post
    <form method="post" action="admin_country.php?mod=newcountry">

    case 'newcountry':
    countrywrite();
    break;

    you're looking in the wrong function.
    Sorry, the form calls another function to write the record, the form is being displayed correctly via the correct link.

    The problem is the browser is interrupting a new page submission when it hits the form, that's the issue I need to work around somehow.

    A couple of people on another forum have suggested ajax, but since I don't know that it's problematic for me at this stage as we simply want to get it up and running and worry about smoothing the rough edges out in a later version.
    www.scaryminds.com ScaryMinds - horror's last colonial outpost.

  13. #13
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    71 Post(s)
    Tagged
    0 Thread(s)
    I read your response. Granted it's 11:30 at night, but... I dont actually understand what you said.

    Which part of the things you pasted to us arnt actually the thing you pasted? The form action, the switch, or the function

  14. #14
    SitePoint Zealot
    Join Date
    Aug 2006
    Location
    Sydney, Australia
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by StarLion View Post
    I read your response. Granted it's 11:30 at night, but... I dont actually understand what you said.

    Which part of the things you pasted to us arnt actually the thing you pasted? The form action, the switch, or the function
    Don't worry about it, have the answer on another forum and will follow their lead on a work around.

    As stated, and people seem not to be getting this, the issue is one with html and page display, not with php or anything else. As it turns out we simply fell into a gotcha and will have to take a couple of steps back to move forward on this project. Slightly irritating but I should have thought things through move thoroughly before splitting the project amongst the team

    Code was posted on request

    Thanks for the answers guys, but we have a workable solution now that is being implemented overnight (our time in Oz).
    www.scaryminds.com ScaryMinds - horror's last colonial outpost.

  15. #15
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,195
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by Salient View Post
    Don't worry about it, have the answer on another forum and will follow their lead on a work around.
    Just so you know, posting the same question on different sites at the same time is not good etty quetty. At least don't admit to it.

    All the same, glad it's sorted.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •