473,666 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript within php

77 New Member
hello all, i have a question..can script of javascript (variable of js or html form)stored within tag php or php command???

thanks


kind regards, maminx
Jul 29 '08 #1
6 1298
r035198x
13,262 MVP
Give an example of what you mean.
Jul 29 '08 #2
maminx
77 New Member
Give an example of what you mean.

the point is i need to call a javascript method within php code, but with no user interaction. i.e. no click of a button, no user input, nothing.


this is the example

i have an input form

[HTML]<input name="textfield " type="text" size="10" value="<?php echo $this->ProjectPraBp_m odel->getProjectPraB pDate("025");?>">
[/HTML]

there's value "025" (bold)...i want that value is from javascript variable / form html object, is it possible??

thanks

maminx
Jul 29 '08 #3
maminx
77 New Member
the point is i need to call a javascript method within php code, but with no user interaction. i.e. no click of a button, no user input, nothing.


this is the example

i have an input form

[HTML]<input name="textfield " type="text" size="10" value="<?php echo $this->ProjectPraBp_m odel->getProjectPraB pDate("025");?>">
[/HTML]

there's value "025" (bold)...i want that value is from javascript variable / form html object, is it possible??

thanks

maminx

is there anyone can help me with this issue??
Jul 31 '08 #4
acoder
16,027 Recognized Expert Moderator MVP
This won't be possible directly. PHP is server-side. It runs and the page finishes execution whereas JavaScript is client-side.

The way to solve your problem would be to make an Ajax request after the page loads with the JavaScript variable. However, having said that, if you already know the JavaScript value, just replace it in the PHP code.
Jul 31 '08 #5
maminx
77 New Member
This won't be possible directly. PHP is server-side. It runs and the page finishes execution whereas JavaScript is client-side.

The way to solve your problem would be to make an Ajax request after the page loads with the JavaScript variable. However, having said that, if you already know the JavaScript value, just replace it in the PHP code.

yes i think it needs ajax, and of i of course i don;t know the javascript value so i can't replace it with the php code..the value is generated with html form or variable of javascript..

But my issue now is because i'm using framework php (codeigniter), than i can't just put the ajax into the php code, there's a rule of framework..

anyway, thanks a lot

kind regards, maminx
Aug 1 '08 #6
acoder
16,027 Recognized Expert Moderator MVP
It must allow some JavaScript which you can put in the head and call when required, e.g. onclick of a button.

If that's not possible, submit the form with a hidden value and set the input value using PHP.
Aug 1 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
8443
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8639
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7385
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4366
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2769
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.