bleustreak12 Posted April 4, 2009 Share Posted April 4, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/152513-creating-call-back-form/ Share on other sites More sharing options...
Daniel0 Posted April 4, 2009 Share Posted April 4, 2009 Will i be able to do that and can i convert the existing code which may be written in another language to php?. Yes. Can somebody help me please? If you tell us what your problem is, then probably. Quote Link to comment https://forums.phpfreaks.com/topic/152513-creating-call-back-form/#findComment-801056 Share on other sites More sharing options...
charleshill Posted April 4, 2009 Share Posted April 4, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/152513-creating-call-back-form/#findComment-801057 Share on other sites More sharing options...
bleustreak12 Posted April 4, 2009 Author Share Posted April 4, 2009 well i have the html one of my problems is that of commentClick(this) in the onclick of leave a comment how will i achieve this through php or something else and if i can achieve this can somebody show me a link or tutorial or text for this Quote Link to comment https://forums.phpfreaks.com/topic/152513-creating-call-back-form/#findComment-801065 Share on other sites More sharing options...
peuge Posted April 4, 2009 Share Posted April 4, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/152513-creating-call-back-form/#findComment-801069 Share on other sites More sharing options...
redarrow Posted April 4, 2009 Share Posted April 4, 2009 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>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/152513-creating-call-back-form/#findComment-801071 Share on other sites More sharing options...
peuge Posted April 4, 2009 Share Posted April 4, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/152513-creating-call-back-form/#findComment-801086 Share on other sites More sharing options...
redarrow Posted April 4, 2009 Share Posted April 4, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/152513-creating-call-back-form/#findComment-801089 Share on other sites More sharing options...
peuge Posted April 4, 2009 Share Posted April 4, 2009 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". Quote Link to comment https://forums.phpfreaks.com/topic/152513-creating-call-back-form/#findComment-801093 Share on other sites More sharing options...
redarrow Posted April 4, 2009 Share Posted April 4, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/152513-creating-call-back-form/#findComment-801102 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.