Jump to content
xisto Community
Sign in to follow this  
Roly

I think I am one of the best PHP programers here ... and thats why I will help you

Recommended Posts

Hmm.. i enter 201 and hit go, and a blank whit page loads. with no result


I put in there getarea.php and put your code in that file. Is this correct?


[br]<form id="headerSearch" action="./getarea.php" method="get">[/br]        <div>[br]       	 <input class="text" type="text" value="Area Code Search"[/br]               onFocus="if (this.value == 'Area Code Search') this.value=''; else this.select();"[br]               onBlur="if (this.value == '') this.value='Area Code Search';" />[/br]             [br]        <input type="submit" class="submit" value="Go!" />[/br]      </div>[br]    </form>[/br]

Share this post


Link to post
Share on other sites

No you need to give a name to your text field. For it to fit my code name it area and make the form method post. It doesn't have to be post, you can leave it as method="get" but you have to change $_POST['area'] in my other code to $_GET['area']. I don't know why I prefer post over get >_>

. Or jsut copy this >_>

<form id="headerSearch" action="./getarea.php" method="post">[/br]       <div>[br]        <input class="text" name="area" type="text" value="Area Code Search"[/br]              onFocus="if (this.value == 'Area Code Search') this.value=''; else this.select();"[br]              onBlur="if (this.value == '') this.value='Area Code Search';" />[/br]            [br]       <input type="submit" class="submit" value="Go!" />[/br]     </div>   </form>

Share this post


Link to post
Share on other sites

Wow you are the *BLEEP*! It works!After the query is done, it is sitting on getarea.php. Is there any way to make it just post the results back to index.html and reload with the results there? Then, it will seem as though you never left the main page.

Share this post


Link to post
Share on other sites

No problem just get all the code from getarea.php and add it to index.html. And change the name index.html to index.php so php works on it. Oh yeah and take the action off your form tag so it goes to the same page.

<form id="headerSearch" method="post">

Share this post


Link to post
Share on other sites

Cool, you are the man. How do I echo a new line though?

[br] echo '<b>Area Code:</b> '.$row['acode'];[/br]

After that I want a \n.

Thanks for all your help!! I'll gladly offer many more questions if you are willing!


-Dennis

Share this post


Link to post
Share on other sites

With single quotes you can make a new line by just pressing enter,

echo 'line 1[/br]line 2[br]another line omg';
With double quotes you can press enter or use \n,

echo "line 1\nline2[/br]another line omg";
And sure ask more questions that's what I'm here for :lol:

Share this post


Link to post
Share on other sites

Ok here is my next project. I will have a tabe in db2 called 'clients'. On the left side of my page, there is a list of clients. When you click on that client, I want it to pull values from db2 (clients) and fill in the body of the page. Is there a way to do this, again, without seeming to leave index.php? Below is some sample data:ClientName: Client XYZ PasswordReset: No, we cannot reset this clients passwords.RemoteAccess: To remote access this client , go to xxx.yyy.zzz.bbb IP Address.So on and so forth. But heres the catch: There is a lot of client specific data that will not fit in other clients categories, so I Was thinking of having some values called CS1 (client-specific 1) through CS10. But, another proble I am thinking of is this: All the other values will have data that I KNOW whats in there, like ClientName. I know for sure that this field will contain the client name, so in the Header before this i can put "Client Name:" and then follow with the data. With the client-specific fields, I won't know what data is about to follow so I dont know how to format my page to read the data and name the field. I dont want to have a section called "CS1:", I'd rather have a way to read in the first word or two and have this be the name of the field (is possible).Any help would be appreciated. Sorry for the lengthy post. Dennis

Share this post


Link to post
Share on other sites

You should add an id to each client and link on the left side of the screen. The link should be something like "index.php?id=1". Then the code should be like,

<?php[/br]if(isset($_GET['id']))[br]{[/br]  $result = mysql_query('SELECT * FROM clients WHERE id = \''.$_GET['id'].'\'');[br]  if(mysql_num_rows($result) > 0)[/br]  {[br]    $row = mysql_fetch_assoc($result);[/br]    echo '<b>ClientName:</b> '.$row['ClientName'].'<br /><b>PasswordReset:</b>'.$row['PasswordReset'].'<br /><b>RemoteAccess:</b>'.$row['RemoteAddress'];[br]  } else[/br]    echo 'Invalid Client ID';[br]}
I hope that helps, I didn't really udnerstand what you want to do >_>

Share this post


Link to post
Share on other sites

Cool, that may work. Let me try to explain what I am trying to do a little better. I am trying to design a new Intranet page for my company. We offer tech support to different companies, and as you could imagine every company infrastructure is different. We have a lot of information on each client like what their server names are, how to connect to them, their document management system, etc. As it sits now, along the left hand side of my page is a toolbar. In this toolbar I have a link to every one of our clients (Approx 30 of them). When you click on a particular company, I want all of their data to come up. What I was thinking may be the best thing to do is create a new table for each client. Since these different companies have such unique information, trying to make one table in SQL that has room for ALL of EVERY client's information is challenging. We have a wide variety of information for each client so making one general template seems like a daunting task.So on to what I think may be the best option. With a separate table for each client, when you click on Client XYZ on the toolbar, the page can open table XYZ which has all of that companies info. It can then run some sort of a loop to keep outputting the next field of information for _THAT_ client until it has reached the end of the table. This way I can have very different info for each client and not have to make some sort of general template that can fit every client. What do you think? Any suggestions?Dennis

Share this post


Link to post
Share on other sites

I don't think having that many tables is a good idea but if you want to go for it. But if you were to do it with only one table I would recommend you store the information with another field, company. That field would be the same if the company information is the same.

For example, company 1 would be like:

Company: 1ClientName: Client XYZ
PasswordReset: No, we cannot reset this clients passwords.
RemoteAccess: To remote access this client , go to xxx.yyy.zzz.bbb IP Address.

Company: 1
ClientName: info
PasswordReset: info
RemoteAccess: info


Then run a mysql query that would look like
mysql_query('SELECT * FROM clients WHERE company = '.$_GET['company']);
Then do a while statement to output all the company information to the page.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.