•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 455,985 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,759 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 367 | Replies: 3
![]() |
•
•
Join Date: Aug 2007
Posts: 10
Reputation:
Rep Power: 2
Solved Threads: 1
hi everyone,
I have some problem about simplifying my php code.
At first I want to load my form and then load my information from database if their are any data exists according to the user name.
Actually the problem is,I want to load the js while the information is their.
thats it..!!
But I want to write it in my js.That will load if data exists.
If their have any alternative way??
I have some problem about simplifying my php code.
At first I want to load my form and then load my information from database if their are any data exists according to the user name.
Actually the problem is,I want to load the js while the information is their.
<?php
$data=mysql_fetch_array[$result];
if($data[0]!=0){
echo"?>
<script>
document.getElementById('text1').value="<?php echo $data[0]";
document.getElementById('text2').value="<?php echo $data[1]";
</script>
<?php
}
?>
thats it..!!
But I want to write it in my js.That will load if data exists.
If their have any alternative way??
•
•
Join Date: Apr 2005
Location: New York state
Posts: 487
Reputation:
Rep Power: 5
Solved Threads: 73
Well aside from the fact that it is syntactically incorrect. You aren't terminating the php blocks when you echo. Remember to end them with ?>. Aside from that, when you get the results find the number of results with mysql_num_rows then do a loop.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h-->++ r z+*
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h-->++ r z+*
if im getting this right you are trying to insert some value from php into the js
if so you could do it like this
if so you could do it like this
<?php echo "<script>some-js-code-with-$varableName</script>"; ?>
programming is an art ,only for those who can understand it.
- th3 php wr3nch -
- th3 php wr3nch -
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Installing Windows 98 On VMware. Floppy problem (Windows 9x / Me)
- Windows XP keeps restarting since a new video card (Windows NT / 2000 / XP / 2003)
- Redhat Linux 6.2 - ipop3d problem? (*nix Software)
- Problem with T720 (Gadgets and Gizmos)
- Connection Problems (Networking Hardware Configuration)
- Encoding (Unicode) problem in IE 6.0 (Web Browsers)
- .htaccess mod_rewrite problem (Linux Servers and Apache)
- Javascript/HTML problem!!! (JavaScript / DHTML / AJAX)
- Problem with Windows Update and WinXP (Web Browsers)
Other Threads in the PHP Forum
- Previous Thread: Uploading and resizing images
- Next Thread: How to properly use tables in db?



Linear Mode