sjones Posted March 27, 2006 Share Posted March 27, 2006 I added a contact us tab form (with two tabs) the file is called from a php script in the index page as follows<?php if (!isset($_GET['p'])) { // no page specified -> load content from default.php include("includes/default.php"); } else { // page specified -> load content from relevant text file include("includes/" . $_GET['p'] . ".php"); } ?>When I use the contact form and click on the General inquiry link a blank page shows up. It loads perfect when I run it from its location. When it is embedded, when I try to use the second tab nothing shows. Here is the link so you can see.[a href=\"http://www.uswebproducts.com/country_savings/test_page/index.php?p=contact_us\" target=\"_blank\"]Click here to see the results[/a]Any Ideas on how to correct this? Here are the scripts that I am using for the tab forms.[b]CONTACT_US.PHP[/b] <html><?phprequire_once("tabs.php");?><head><?php tabs_header(); ?></head><body><div style="width: 420px;"><?php tabs_start(); ?> <?php tab( "Advertising Contact Form" ); ?> <span class="content_blank">Thank you for your interest in Country Savings Magazine!</span><br> <form action="index.php?p=handle_contact" method="get"> <br><span class="content_blank"><strong>First and Last name:</strong></span> <br><input name="name" type="text" size="40" maxlength="50"> <br><span class="content_blank"><strong>Company name:</strong></span> <br><input name="company_name" type="text" size="40" maxlength="50"> <br><span class="content_blank"><strong>Address:</strong></span> <br><input name="address" type="text" size="40" maxlength="50"> <br><span class="content_blank"><strong>City:</strong></span> <br><input name="city" type="text" size="40" maxlength="50"> <br><span class="content_blank"><strong>State:</strong></span> <br><input name="state" type="text" value="OH" size="2" maxlength="2"> <br><span class="content_blank"><strong>Zip Code:</strong></span> <br><input name="zip_code" type="text" size="10" maxlength="10"> <br><span class="content_blank"><strong>Phone#:</strong></span> <br><input name="phone" type="text" size="17" maxlength="17"> <br><span class="content_blank"><strong>Cell Phone#:</strong></span> <br><input name="cell_phone" type="text" size="17" maxlength="17"> <br><span class="content_blank"><strong>Fax#:</strong></span> <br><input name="fax" type="text" size="17" maxlength="17"> <br><span class="content_blank"><strong>Comments or Questions:</strong></span> <br><textarea name="comments" cols="45" rows="4"></textarea> <br> Press send, we will recieve your inquiry and contact you shortly. <br><br><input name="submit" type="submit" value="Send"> </form> <?php tab( "General interest Contact Form" ); ?> <span class="content_blank">Thank you for your interest in Country Savings Magazine!</span><br> <form action="index.php?p=handle_contact" method="get"> <br><span class="content_blank"><strong>First and Last name:</strong></span> <br><input name="name" type="text" size="40" maxlength="50"> <br><span class="content_blank"><strong>Address:</strong></span> <br><input name="address" type="text" size="40" maxlength="50"> <br><span class="content_blank"><strong>City:</strong></span> <br><input name="city" type="text" size="40" maxlength="50"> <br><span class="content_blank"><strong>State:</strong></span> <br><input name="state" type="text" value="OH" size="2" maxlength="2"> <br><span class="content_blank"><strong>Zip Code:</strong></span> <br><input name="zip_code" type="text" size="10" maxlength="10"> <br><span class="content_blank"><strong>Phone#:</strong></span> <br><input name="phone" type="text" size="17" maxlength="17"> <br><span class="content_blank"><strong>Cell Phone#:</strong></span> <br><input name="cell_phone" type="text" size="17" maxlength="17"> <br><span class="content_blank"><strong>Fax#:</strong></span> <br><input name="fax" type="text" size="17" maxlength="17"> <br><span class="content_blank"><strong>Comments or Questions:</strong></span> <br><textarea name="comments" cols="45" rows="4"></textarea> <br> Press send, we will recieve your inquiry and contact you shortly. <br><br><input name="submit" type="submit" value="Send"> </form> <?php tabs_end(); ?></div></body></html>[b]TABS.PHP[/b] <?php$tabs = array(); function tabs_header(){?><style type="text/css">.tab { border-bottom: 1px solid black; text-align: center; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }.tab-active { border-left: 1px solid black; border-top: 1px solid black; border-right: 1px solid black; text-align: center; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; }.tab-content { padding: 5px; border-left: 1px solid black; border-right: 1px solid black; border-bottom: 1px solid black; font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif;}</style><?php } function tabs_start() { ob_start(); } function endtab() { global $tabs; $text = ob_get_clean(); $tabs[ count( $tabs ) - 1][ 'text' ] = $text; ob_start(); } function tab( $title ) { global $tabs; if ( count( $tabs ) > 0 ) endtab(); $tabs []=array( title => $title, text => "" ); } function tabs_end() { global $tabs; endtab(); ob_clean(); $index = 0; if ( $_GET['tabindex']) $index = $_GET['tabindex'];?><table width="100%" cellspacing="0" cellpadding="0"><tr><?php $baseuri = $SERVER['REQUEST_URI']; $baseuri = preg_replace( "/\?.*$/", "", $baseuri ); $curindex = 0; foreach($tabs as $tab) { $class = "tab"; if ( $index == $curindex ) $class ="tab-active";?><td class="<?php echo($class); ?>"><a href="<?php echo( $baseuri . "?p=contact_us?tabindex=".$curindex );?>"><?php echo( $tab['title'] ); ?></a></td><?php $curindex += 1; }?></tr><tr><td class="tab-content" colspan="<?php echo( count( $tabs ) + 1 ); ?>"><?php echo( $tabs[$index ]['text'] ); ?></td></tr></table> <?php}?> Link to comment https://forums.phpfreaks.com/topic/5937-embedded-php-script-not-working/ Share on other sites More sharing options...
shocker-z Posted March 27, 2006 Share Posted March 27, 2006 [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<a href="<?php echo( $baseuri . "?p=contact_us?tabindex=".$curindex );?>">[/quote]needs to be[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<a href="<?php echo( $baseuri . "?p=contact_us&tabindex=".$curindex );?>">[/quote]& seperates all the diffrent url variables :) Link to comment https://forums.phpfreaks.com/topic/5937-embedded-php-script-not-working/#findComment-21229 Share on other sites More sharing options...
sjones Posted March 27, 2006 Author Share Posted March 27, 2006 [!--quoteo(post=358922:date=Mar 27 2006, 10:50 AM:name=shocker-z)--][div class=\'quotetop\']QUOTE(shocker-z @ Mar 27 2006, 10:50 AM) [snapback]358922[/snapback][/div][div class=\'quotemain\'][!--quotec--]needs to be& seperates all the diffrent url variables :)[/quote]OK I have changed it to this<td class="<?php echo($class); ?>"><a href="<?php echo( $baseuri . "?p=contact_us&?tabindex=".$curindex );?>"><?php echo( $tab['title'] ); ?>Now the tabs wont change when clicked. It says that tabindex=1 but it does not change to the other form.Any Ideas?? Link to comment https://forums.phpfreaks.com/topic/5937-embedded-php-script-not-working/#findComment-21250 Share on other sites More sharing options...
shocker-z Posted March 27, 2006 Share Posted March 27, 2006 you added a ?it should be<td class="<?php echo($class); ?>"><a href="<?php echo( $baseuri . "?p=contact_us&tabindex=".$curindex );?>"><?php echo( $tab['title'] ); ?>you onlu need 1 question mark and then use & to seperate the restRemember to change the other link too incase someone is wanting to change back to first page :) Link to comment https://forums.phpfreaks.com/topic/5937-embedded-php-script-not-working/#findComment-21252 Share on other sites More sharing options...
sjones Posted March 27, 2006 Author Share Posted March 27, 2006 [!--quoteo(post=358922:date=Mar 27 2006, 10:50 AM:name=shocker-z)--][div class=\'quotetop\']QUOTE(shocker-z @ Mar 27 2006, 10:50 AM) [snapback]358922[/snapback][/div][div class=\'quotemain\'][!--quotec--]needs to be& seperates all the diffrent url variables :)[/quote][b]Thank You[/b] - That worked great - Link to comment https://forums.phpfreaks.com/topic/5937-embedded-php-script-not-working/#findComment-21259 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.