Jump to content

pre-filling forms on other websites


austin350s10

Recommended Posts

I have developed a form for my website that directs the user to a different site and per-populates the form on the other site with information I want.  I would like to take it one step further and make the below script fill out the form on the other site and then submit the form.  Currently it just fills out the form on the other site but does not submit it.  Is there any way to do this?

 

<form action="http://www.privatedutyhomecare.org/sections/consumers/locator.php" method="POST">
	<input name="state" size="25" type="hidden" value="MI" />
	<input name="company" size="25" type="hidden" value="Affordable HomeCare" />
			<button type="submit" class="imgpx">
						<img src="assets/images/logos/npda.png" alt="submit" width="51" class="nothing" height="40" />
			</button>
</form>

Link to comment
Share on other sites

not too sure how to do this.  Below is the code of the form on the other site.  I am trying to make my form fill out this form and basically make it click the submit button to show the user the results.  Can this be done?

 

<form method="POST" action="locator.php">

	<p> <b>Select one or more criteria to search by:</b> </p>

	<p> <label for="i_company">Company:</label> <input type="text" name="company" id="i_company" size="30" value="" /> </p>

	<p> <label for="i_city">City:</label> <input type="text" name="city" id="i_city" size="20" value="" /> </p>

	<p> <label for="i_state">State:</label>

		<select name="state" id="i_state">
			<option value="" selected="selected">Any</option>
			<option value="AL">Alabama</option>
			<option value="AK">Alaska</option>
			<option value="AZ">Arizona</option>
			<option value="AR">Arkansas</option>

			<option value="CA">California</option>
			<option value="CO">Colorado</option>
			<option value="CT">Connecticut</option>
			<option value="DE">Delaware</option>
			<option value="DC">District of Columbia</option>
			<option value="FL">Florida</option>

			<option value="GA">Georgia</option>
			<option value="HI">Hawaii</option>
			<option value="ID">Idaho</option>
			<option value="IL">Illinois</option>
			<option value="IN">Indiana</option>
			<option value="IA">Iowa</option>

			<option value="KS">Kansas</option>
			<option value="KY">Kentucky</option>
			<option value="LA">Louisiana</option>
			<option value="ME">Maine</option>
			<option value="MD">Maryland</option>
			<option value="MA">Massachusetts</option>

			<option value="MI">Michigan</option>
			<option value="MN">Minnesota</option>
			<option value="MS">Mississippi</option>
			<option value="MO">Missouri</option>
			<option value="MT">Montana</option>
			<option value="NE">Nebraska</option>

			<option value="NV">Nevada</option>
			<option value="NH">New Hampshire</option>
			<option value="NJ">New Jersey</option>
			<option value="NM">New Mexico</option>
			<option value="NY">New York</option>
			<option value="NC">North Carolina</option>

			<option value="ND">North Dakota</option>
			<option value="OH">Ohio</option>
			<option value="OK">Oklahoma</option>
			<option value="OR">Oregon</option>
			<option value="PA">Pennsylvania</option>
			<option value="RI">Rhode Island</option>

			<option value="SC">South Carolina</option>
			<option value="SD">South Dakota</option>
			<option value="TN">Tennessee</option>
			<option value="TX">Texas</option>
			<option value="UT">Utah</option>
			<option value="VT">Vermont</option>

			<option value="VA">Virginia</option>
			<option value="WA">Washington</option>
			<option value="WV">West Virginia</option>
			<option value="WI">Wisconsin</option>
			<option value="WY">Wyoming</option>
		</select>

	</p>

	<p> <b>Or search within a specified distance by entering your zip (U.S.) or postal (Canada) code:</b> </p>

	<p> <label for="i_zip_code">Zip/Postal code:</label> <input type="text" name="zip_code" id="i_zip_code" size="7" maxlength="7" value="" /> </p>

	<p>

		<label for="i_distance">Within:</label>
		<select name="distance" id="i_distance">
			<option value="5">5</option>
			<option value="10">10</option>
			<option value="20" selected="selected">20</option>
			<option value="50">50</option>

			<option value="100">100</option>
			<option value="150">150</option>
			<option value="200">200</option>
			<option value="250">250</option>
		</select> miles
	</p>

	<p> <b>Optionally specify type of business:</b> </p>

	<p class="aligned"> <label for="i_business_type" class="inline">Type of Business:</label> <em>Hold down CTRL (PC) or Command (Mac) key and click to select more than one value</em> <br />

		<select name="business_type[]" id="i_business_type" multiple="multiple" size="4">
			<option value="Attendant Care">Attendant Care</option>

			<option value="Case Management">Case Management</option>
			<option value="Companion Care">Companion Care</option>
			<option value="Home Maker">Home Maker</option>
			<option value="Home Health Aide">Home Health Aide</option>
			<option value="Infusion Therapy">Infusion Therapy</option>
			<option value="Maternal/Child">Maternal/Child</option>

			<option value="Medical Adult Day Care">Medical Adult Day Care</option>
			<option value="Pediatrics">Pediatrics</option>
			<option value="Respite Care">Respite Care</option>
			<option value="Sitter">Sitter</option>
			<option value="Skilled Nursing">Skilled Nursing</option>
			<option value="Other">Other</option>

		</select>
	</p>

	<input type="hidden" name="search_type" value="Consumer Search" />		<p class="aligned"> <input type="submit" value="Search" /> </p>
	<input type="hidden" name="submit" value="1" />
</form>

Link to comment
Share on other sites

Yes. Take the stuff you just copied, change the form action to the full URL for locator.php, and rearrange the fields however you want. You can change anything except for field names, and all of them probably need to be in the form (meaning you probably can't remove any).

Link to comment
Share on other sites

I did do this on the form on my site.  Just didn't use all the items from the other site.  the form on my site will pre-fill in the fields on the other site but I cant figure out how to submit the other sites form from my form.  Is there a way my sites form can submit the form from the other site?

 

something that would trigger this code on the other sites form:

<input type="submit" value="Search" />

Link to comment
Share on other sites

This forum is for people to get help with code they have written. You can either post in the freelance forum to see if anyone wants to do this for you (for $$$) or you can do a simple web search to find a tutorial for using cURL. Give the tutorial a try and if you have problems, post back here with what you have, what problems you encountered, etc. and we will try to help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.