Hi,

I want to populate 2 javascript variables with data from 2 form text boxes, the javascript and form text bosex are on the same page using the following code:

Form:

<form name="addSite" method="post" action=""> <label>URL: <input name="url" type="text" id="url" value="<? echo $site; ?>"> </label> <p>Title: <input type="text" name="title"> </p> </form>

How would i populate the javascript variables: 'addSite' and 'title' with the respective form data?

Recommended Answers

All 2 Replies

Don't know what you want to do exactly, but you access the value of the input forms in javascript by:

document.formName.inputName.val()

Are you trying to do this on PHP? This does not look like JavaScript when you try to use '<?' and '?>' symbol.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.