Old 02-28-2009   #1 (permalink)
Registered User
 

Join Date: Dec 2008
Posts: 20

mysql and php displaying in website

hello guy s,
i have made a form called contact in my database using mysql,and i wrote simple php code to connect my database.also another linked form i called phonebook.php which where i post my index.php using this format:

Code:
<form action="phonebook.php" method="post">
When i save contacts from my webpage i can locate it in the databse but it dosent display in my webpage.
this is my codes index.php
PHP Code:
[SIZE=1]<label for="FirstName" id="ctl01">First Name</label><div class="InputColumn"/>
<input name="FirstName" type="text" maxlength="50" id="FirstName" /><?echo $err01?>
<br/>
<label for="LastName" id="ctl04">Last Name</label><div class="InputColumn"/>
<input name="LastName" type="text" maxlength="50" id="LastName" /> <? echo $error2?> 
<br/>
phone<div class="InputColumn"/>
<input name="phone" type="text" maxlength="50" /><? echo $error3?>
<br/>
<label for="Comments" id="ctl25">Comments</label><div class="InputColumn"/>
<textarea name="Comments" rows="6" cols="30" id="Comments"></textarea>
<br/>
favorite: 
<input type="checkbox" name="favorite" value="favorite"/>
<br/>
<input type="submit" value="submit" name="submit" />
</fieldset>
</form>
<fieldset>
<table border="1"> 

<tr> 
<th>S.Num</th>
<th>First Name</th>
<th>Last Name</th>
<th>Description</th>
<th>Phone Number</th>
<th>Favorite</th> 
</tr>
<?
mysql_connect
("localhost","godoke08","FTvmkN51") or die("error: cannot connect database");
mysql_select_db("godoke08");
$qr=mysql_query("INSERT INTO Contact");
{
?>
<tr> 
<td>abc</td>
<td>godwin</td> 
<td>abc</td>
<td>abc</td>
<td>abc</td>
<td>abc</td>
</tr>
<?
}
?>
</table>
<br/>
 
 
 
</fieldset>
</body>
</html>
[/SIZE]

Last edited by Man1c M0g; 02-28-2009 at 11:55 PM.
dongodwins is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-02-2009   #2 (permalink)
Registered User
 

Join Date: Aug 2004
Posts: 143

Well you're missing the start of the HTML tags.. DOCTYPE, Head, HTML, title, etc... Or perhaps you didn't post all the code.

You might also try traditional php tags
PHP Code:
<?php
rather than the shorthand
PHP Code:
<?
Jolt is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-04-2009   #3 (permalink)
Registered User
 

Join Date: Dec 2008
Posts: 20

this not all the codes i have made two coded called phonebook.php and another index.php index.php contain all the php and basic html code but this phonebook.php conects me to a database to which what i write to base are printed.
dongodwins is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-04-2009   #4 (permalink)
Registered User
 
U'ziel's Avatar
 

Join Date: Sep 2005
Posts: 88
Images: 1

<? echo $error3; ?>

Is nasty it should be;

<?=$error3?>

Was this what is not displaying?

This bit is unclear;

<?
mysql_connect("localhost","godoke08","FTvmkN51") or die("error: cannot connect database");
mysql_select_db("godoke08");
$qr=mysql_query("INSERT INTO Contact");
{
?>
<tr>
<td>abc</td>
<td>godwin</td>
<td>abc</td>
<td>abc</td>
<td>abc</td>
<td>abc</td>
</tr>
<?
}
?>
Maybe it's me skim reading it I don't know what this is meant to do, looking at your HTML I think you want this to print whats in the DB into that table, but the code looks like you are trying to insert HTML tags into your DB? Which is it and i'll tell you where you went wrong?
U'ziel is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-04-2009   #5 (permalink)
Registered User
 

Join Date: Dec 2008
Posts: 20

dnt worry about the html tags there all php and html tags i need are all in another form i called index.php.this form i poated here i called it phonebook.php.this what am doing.when i insert items into my databse i also want the item to be printed in the table which i amde in the index.php.the table here its just an example of what i did.


and uziel the error are arrays i used is not important any more to print when each each string like firsname or lastname is empty to print fill the data.
dongodwins is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-04-2009   #6 (permalink)
Registered User
 

Join Date: Aug 2004
Posts: 143

PHP Code:
<?=$error3?>
Sorry, I feel that's "nasty." Shorthand php leads to less portability.
Jolt is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-04-2009   #7 (permalink)
Registered User
 
U'ziel's Avatar
 

Join Date: Sep 2005
Posts: 88
Images: 1

Each to their own...
U'ziel is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-06-2009   #8 (permalink)
Registered User
 

Join Date: Dec 2008
Posts: 20

am done with and ran into another am buliding a webshop i have problems of placing my php codes and javascripts and normal html tags which will inlock ech other
dongodwins is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-19-2009   #9 (permalink)
Registered User
 

Join Date: Dec 2008
Posts: 20

how can i assign a password to my admin page so it pop up login like user and password .when someone tries to view it.
dongodwins is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-20-2009   #10 (permalink)
Registered User
 
U'ziel's Avatar
 

Join Date: Sep 2005
Posts: 88
Images: 1

do you mean it pops up in a system window type thing or you want to write a custom popup? I think your thinking about a htaccess file. Check this link out;

Apache Tutorial: .htaccess files - Apache HTTP Server

Most hosters offer this feature to their clients through their CMS.

I'm not sure if this works but you could try it out:
Htpasswd Generator - Create a htpasswd password
U'ziel is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-20-2009   #11 (permalink)
Registered User
 

Join Date: Dec 2008
Posts: 20

i just wrote a code for a webshop,using basic php,html, and little javscript.i have a foler calle admin.php from where the owner can add products to his database.i need assign user acces to it so unauthorised acces can not view the codes.like in a webpage u can right click and view soure i want to prvent that.
dongodwins is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-20-2009   #12 (permalink)
Registered User
 
U'ziel's Avatar
 

Join Date: Sep 2005
Posts: 88
Images: 1

Theres no point investing any time in writing code to prevent right clicking on viewing source, this can be scrapped using scripts.

Just secure admin.php directory with a .htaccess file. (I'm assuming your web server is running apache) if not you will need to find the equivalent. The .htaccess file once properly installed into that directory will load a popup like the one i've attached that the user will need to login to otherwise the page will not display. The contents of that directory will not be downloadable without first logging in.



Is the attached/edited popup window what you are after?
Attached Images
File Type: bmp htaccess_xmpl.bmp (338.8 KB, 14 views)
U'ziel is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-22-2009   #13 (permalink)
Registered User
 

Join Date: Dec 2008
Posts: 20

thanks uziel using codes are more safe then htacces.i have tried it i can overide htacces but when php codes are used u can hie the code probably securing ur admin page.
dongodwins is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-23-2009   #14 (permalink)
Registered User
 

Join Date: Aug 2004
Posts: 143

In order to use PHP to to secure a directory, you need to set a cookie or session cookie to check against for every admin page that loads. It's also best to store the account name and password (md5'd) in a database. Check out the php membership tutorial here at Biorust.
Jolt is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
php and mySQL loverofbeats HTML / PHP / ASP / JS 4 10-24-2008 12:39 PM
computing problem - No Web Pages displaying DrkDeath General Discussions 8 11-10-2006 05:55 AM
MYSQL Help Neil_8_24_93 HTML / PHP / ASP / JS 2 08-07-2006 07:15 PM
Displaying directory on a webserver ? malboroman HTML / PHP / ASP / JS 3 06-21-2004 10:22 PM


All times are GMT +1. The time now is 02:15 AM.

Powered by vBulletin Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.2

Design & Content © BioRUST 2008 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT