Jump to content

How do they do this ?


devouk

Recommended Posts

Hi all

 

Looking for a bit advice on the following

 

The original idea was a demo site that was created for us on a new look website, but the company seems a bit reluctant to put in to a cms and also do the changes.. but one thing they have done which demistifises  me and any google searching i been doing the following days

 

Basically they have a "start an enquiry" form on each page.

 

The form has name, phone, product query, and area

 

This then is posted via a "post" to an enquiry.php page which is a full form and the values are populated with new extra fields and a captucha.

 

I looked at the html and the javascript and there is nothing there so i presume they have done it with php.

 

Now the enquiry page is its own entity .. ie no values passed and thus all fields are empty ie value=""

 

i even tried to see if i "start an enquiry" if it echo the code thus i would be able to see this in the html which it doesnt.

 

can someone point me in the direction of how to do this.

 

is it done with php and dom which i havent really got a clue

 

http://www.crearesites.co.uk/bradrail

 

I find this a usefull feature but seems rarely discussed and wish to be enlightened.

 

Many thanks

 

 

 

 

 

 

 

Link to comment
Share on other sites

This is basic PHP form handling.  Are you familiar with PHP at all, or are you just curious as to how they did this?  ??? Basically, when the data get passed along to enquiry.php, they are put into the $_POST array.  They can then use this array to populate the form fields.

Link to comment
Share on other sites

Hi Darkwater

 

Thanks for the fast reply.. yeah i know basic php.. and i understand that the "post" send its an array .. but it was how i take the items from the array and push them from a variable back in to the form elements of textboxes off the new form.. without compromising the form if accessed without the post parameters

 

can you tell me the best way of doing this ?

 

Thanks

Link to comment
Share on other sites

Well, since the value of a text input can be set with the value="" parameter, this works:

 

<?php
//assume you took care of sanitizing POST and all sorts of stuff up here
printf('<input type="text" name="address" value="%s" />', (isset($_POST['address']) ? $_POST['address'] : ''));

Link to comment
Share on other sites

thanks darkwater.. you pointer me in the right direction and then played with what you gave and refined it to the point where i need to do a bit of error checking... it seems so easy

 

what i did

 

<?php

$name=$post['name'];

?>

 

 

<form method="post" action="processed.php">

 

<p>Name<input name="name" value="<?php print($name) ?>" type="text" class="formstyle" size="25" maxlength="50" style="width: 160px;" /> <br/>

 

</form>

 

I am greatefull for you bearing with me for a php fixer rather than programmer. !

 

 

 

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.