Forum Moderators: coopster

Message Too Old, No Replies

Convert JavaScript to PHP

document.write question

         

woldie

2:02 pm on May 20, 2004 (gmt 0)

10+ Year Member



Hi,

I've used some JavaScript to calculate some figures (because it would of been a nightmare to do it using PHP), however I've used document.write to output the final output.

How do I convert this bit code to PHP? The reason being is because I want to place this figure in the database.

I want to place 'value' into the DB.

<SCRIPT LANGUAGE="JavaScript">
document.write( value + "%");
</script>

Any ideas?

Thanks in advance

timster

2:16 pm on May 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not quite sure what you're up to here, but would something like this do what you need?

// JavaScript
document.formName.fieldName.value = value + "%"

// Or, if you're creating the Web page from JavaScript

document.write ('<form name="formName"><input type="hidden" name="fieldName" value="' + value + '"><input type="submit"></form>"

Then just submit it to the PHP page to process the form input.