Jump to content

Recommended Posts

I want to create a form similar to the one on this site in php:

 

http://www.centreforsight.com/default.aspx

 

(!!check the leave a comment box!!!)

 

Will i be able to do that and  can i convert the existing code which may be written in another language to php?.

 

Can somebody help me please?

Link to comment
https://forums.phpfreaks.com/topic/152513-creating-call-back-form/
Share on other sites

You can make that form with HTML and DHTML (View page source and then look at the onclick attribute in the HTML tag around the Leave a comment checkbox).  The actual processing of the form could be done with PHP.  If you explain more specifically what parts of this you are having difficulties with I can help you.

In your contact form you need to create and empty <tr> or <div> whichever you using. and give it and id of anything you wish. Your actual check box must also have an id.

You have a javascript function:

function onCheck(){
 var objComment = document.getElementById('your comment checkbox id').value;  
 var objCommentBox = document.getElementById('your comment box td/div id');
 var commentArea = new textArea;
 if (objComment == true){    
   objCommentBox.appendChild(commentArea);    
 }
 else{
   objCommentBox.removeChild(commentArea);
 }


}

Then once you submit just use a $_POST['you comment box id'] to get the input data

Have not checked the code, but hopefully you get the idea.

 

Peuge :)

php way (( thank you be nice.

this is a clone of the form on the page.

<?php

echo"

<div style='width: 250px; background-color: #999999;' >

<form method='POST' action=' '>

<select name='user_title'>
<option>Mr</option>
<option>Ms</option>
<option>Mr</option>
<option>Mrs</option>
<option>Dr</option>
</select>

<br><br>

<input type='text' name='user_firstname' value='First Name'>
<br><br>
<input type='text' name='user_surname' value='Surname' >
<br><br>
<input type='text' name='user_phone' value='phone'>
<br><br>
<input type='text' name='user_email' value='Email'>

";

echo "<br><br><a style='text-decoration: none; color: #000000;' href='{$_SERVER['PHO_SELF']}?cmd=comment'>Leave a comment?</a>";

if(isset($_GET['cmd'])&& $_GET['cmd']=="comment"){

echo"<br><br><textarea style='margin-left: 15px; name='user_comment' cols='25' rows='10'>Comment</textarea>

<br><br>
<input type='button' name='user_agree'>
Agree to  Terms and Conditions for the use of email !   

";
}

echo"
<br><br>
<input type='button' name='user_seminar'>
Free Seminar
<br><br>
<input type='button' name='user_consultation'>
Free IntraLASIK Consultation
<br><br>
<input type='button' name='user_call_back'>
Call Back
<br><br>
<input style='border: 0; background-color: #333399; margin-left: 180px;' type='submit' name='submit' value='Submit'>
<br><br>

</div>";

?>

The above will work, except in the page quoted they use check boxes, so

echo "<br><br><a style='text-decoration: none; color: #000000;' href='{$_SERVER['PHO_SELF']}?cmd=comment'>Leave a comment?</a>";

will come out as a link with no checkbox?

Also they dont use buttons, its checkboxes.

:)

does not matter will work, invent your own not copy.

 

how will you ever learn?

 

real programmers dont copy and past do they?

 

my code is a example to do it the php way and html,

 

javascript is over kill.

 

i only post the code, as i think it only right you use php and html not javascript, javascript is why the net is full off crap.

Just saying that he wanted a checkbox. And why use a link in a form when you can use what is there for you, a nice checkbox. Also IMO Javascript and PHP both have their uses (server/client), a script like this is hardly clutter. You would also have to add another link to undo leave a comment.

 

"does not matter will work, invent your own not copy.

how will you ever learn?

real programmers dont copy and past do they?"

 

"this is a clone" -> Is that not copying?

 

Anyways was not being rude and didn't want to start an argument, just giving options to do it, I did not copy the other pages javascript so yes "real programmers don't copy and past".

 

 

 

 

We don't argue on phpfreaks we debate, we love it.

 

Right firstly, Don't need a close link to close the comment box, because why open it?

 

secondly.

 

To clone a web site is to clone the a design and features,

 

But we all use the programming functions and scripting we no,

 

Cloning dose not mean we have to use the exact programming code, just

make sure the web sites in mention, look the same.

 

I Don't argue i debate.

 

ps. You continue to post javascript on a php forum,but at the same time your not

adding no non script javascript code for browser compliance.

 

helping others also means throwing in some extra help

 

well any way hope you all the best, as can see you no your stuff.

 

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.