PHP newbie needs help with form submit

Hi, I am new with PHP and have this website that im trying to help sort out… at the moment none of the “send” or “submit” buttons work and I cannot see where… can someone please advise me using non techie speak!!
First code is the “actions” php
[php]<?php require_once(‘includes/variabile.php’);$action = ($_POST[‘action’])? $_POST[‘action’] : $_GET[‘action’];switch($action){ case “contact”: $name = $_POST[‘name’]; $message = $_POST[‘message’];mail($email_patron,‘Contact from a client’, $message,‘From: ‘.$name.’ <’.$_POST[‘mail’].’>’ . “\r\n”."Reply-to: " . $_POST[‘mail’] . “\r\n”);Header(‘Location: contact.php?res=email_sent’);die();
break;//not necessary, just for style
case “quote”:
print_r($_POST);
die();
Header(‘Location: instantquote.php’);
die();
break;//not necessary, just for style

case "email_client":
		$email = $_POST['email'];
	
		mail($email,'Your quote at christianvelectrical.com', 
					urldecode($_POST['content'])
					,
					'From: '.$name.' <'.$_POST['email'].'>' . "\r\n".
					"Reply-to: " . $_POST['email'] . "\r\n".
					"Content-type: text/html \r\n");
										
			
	 		break;
case "request_call":	 
		
			$numerc  = $_POST['numerc'];
			$phonerc = $_POST['phonerc'];
			$now	 = $_POST['now'];
			$calendar	 = $_POST['calendar'];
			
			
			mail($sales,'Request a call', 
				"Nume "    . $numerc . "\r\n" .
				"Phonerc " . $phonerc . "\r\n" .
				"Date selected " . 	 $calendar . "\r\n"  );
					/*'From: '.$name.' <'.$_POST['mail'].'>' . "\r\n".
					"Reply-to: " . $_POST['mail'] . "\r\n");*/
			
	 		break;
	 		
case "email_patron":	 
			//print_r($_FILES);
			//print_r($_POST);
			$file = $_FILES['file']['tmp_name'];
			$filename = $_FILES['file']['name'];
			$ext = pathinfo($filename,PATHINFO_EXTENSION );
			
			if($file){
				if(substr_count($filename,'.')>1)
					die('There must be exactly one . character in the filename');
				
				if(!in_array($ext, array('gif','jpg','jpeg','bmp')))
					die('File extension must be gif,png,jpg,jpeg or bmp!');
				
				if(!imagecreatefromjpeg($file) && !imagecreatefrompng($file) && !imagecreatefromgif($file))		
					die('You must upload a valid gif,png,jpg,jpeg or bmp!');		
				
				if(is_uploaded_file($file)){
					move_uploaded_file($file,'/var/www/vhosts/christianvelectrical.com/httpdocs/ups/'. $_FILES['file']['name']);
				}else{
					//die('not ifile');
				}
			}
			
			
			mail($email_patron,'Quote de client-ul ' . $_POST['name'], 
					"\n\nNume  " . $_POST['name']. "<br>\n\n".	
					"Email  " . $_POST['email']. "<br>\n\n".
					"Tel  " . $_POST['tel']. "<br>\n\n".
					"Total " . $_POST['total']. "<br>pounds <br><br>\n\n".
					"Comments " . $_POST['comments']. " <br><br>\n\n".	
					'Link poza http://christianvelectrical.com/ups/'.$filename. "<br><br>\n\n".
					urldecode($_POST['content'])
					,
					'From: '.$name.' <'.$_POST['email'].'>' . "\r\n".
					"Reply-to: " . $_POST['email'] . "\r\n".
					"Content-type: text/html \r\n");
			
			//die('email sent');
	 		break;	 				 		

}

?>[/php]
Contact php
[php]<?php include "includes/top.php"?>

<?php include "includes/menu.php"?> <?php include "includes/cover.php"?>

SEND A MESSAGE

Here is your chance to tell us what your needs are.
Complete the form below and we will respond as soon as possible.

<?php if($_GET['res'] == 'email_sent'){?> Your email has been sent, thank you! <?php } ?>
<div id="BoxSendMessage"> 
	<div id="TTCS"></div>
	<div id="TTCD"></div>
	<div id="TTT"></div>
	<div id="TTL"></div>
	<div id="TTR"></div>
	<div id="SendMessageText">
		<p id="T" style="font-size: 12px; font-style: normal; line-height: 100%;"> Name <br /> <br /> <br /> Email <br /> <br /> <br />Your Message </p> 
	</div>
	<form action="actions.php?action=contact" method="POST" >
		<input id="Nume" type="text" name="name" value="Your Name" style="border-radius: 4px; color:#888888;" onfocus="if (this.value=='Your Name') {this.value='';}"/>
		<input id="Mail" type="text" name="mail" value="Your E-Mail" style="border-radius: 4px; color:#888888;" onfocus="if (this.value=='Your E-Mail') {this.value='';}"/>
		<textarea id="Message" type="text" name="message" value="Your Message" style="border-radius: 4px; color:#888888;" onfocus="if (this.value==' Your Message ') {this.value='';}"> Your Message </textarea>
		
		<a id="SendM" onmouseout="SEN()" onmouseover="SEND()" onclick="action(); return false;" style="cursor: pointer">
			<div id="BColtS"> </div>
			<div id="ABSs"> <p id="T" style="font-size: 12px; font-style: normal; line-height: 60%; margin-left: 9px;"> Send </p> </div> 
			<div id="BColtD"> </div> 
		</a>
	</form>	
</div>
<?php include "includes/bottom.php"?>
</div>
</td>
[/php] any help would be appreciated!

Do they not work or is the post data not being sent ?
I found that java and forms do not work well when using java on the send button.

Hi, they just dont work, when you go to click on the submit/send button nothing happens. there isnt even a hint … a bit like lights are on but no-bodys home!

Does the page refresh as if the button was pressed ?

no nothing happens at all, all that happens is the button changes colour! www.christianvelectrical.com

I would look at changing the submit button to test it out to start with and updating the jquery script to the newest.

<form action="actions.php?action=contact" method="POST">
<!--
< input type="checkbox" name="now" id="now" value="now" style="position:absolute; display:block; margin: 55px 45px;"/ >
-->
<input class="hasDatepicker" id="calendar" name="calendar" value="Your Time" style="border-radius: 4px; color:#888888;" type="text">
<input id="numerc" name="numerc" value="Your Name" style="border-radius: 4px; color:#888888;" onfocus="if (this.value=='Your Name') {this.value='';}" type="text">
<input id="phonerc" name="phonerc" value="Number" style="border-radius: 4px; color:#888888;" onfocus="if (this.value=='Your Phone No.') {this.value='';}" type="text">
<a id="SendC" onmouseout="SENC()" onmouseover="SENDC()" onclick="requestCall(); return false;" style="cursor: pointer">
<div id="BColtS">
</div>
<div id="ABSs">
<p id="T" style="font-size: 12px; font-style: normal; line-height: 60%; margin-left: 9px;">
Send
</p>
</div>
<div id="BColtD">
</div>
</a>
</form>

Try a basic submit with the java function in it

[code]

<input type=“submit” name=“submit” value=“Send” id=“SendC” onclick="requestCall(); />

[/code]

thanks ill igve that a go when i get home… ! if it dont work ill let you know… can i PM u if there is a problem?

I get a email when you post so no point in pm’ing me as I have email turned off for that also people want to see the results and how it was fixed.

The number input needs the (this.value==‘Your Phone No.’) changed to (this.value==‘Number’) for the value to be reset to nothing on click or change the value=“Number” to value=“Your Phone No.”.

This is really a ajaxa problem and not a php problem.

brilliant, ok ill check all those and report my findings…thanks once again

the send button works but it comes up with an internet explorer error page… removed the code for now

Moving it to the java ajax forum.

I noticed on your site your had a different function onclick than the one you gave in the post above.

onclick="action();
onclick="requestCall(); 

In the last part of this code there is a function called function not sure if this is right as function should be only used when making a function not calling. function(data)

But this could be the way java is coded and I am not good with it.

[code]function requestCall(){
console.log(‘test’);
$.post(‘actions.php?action=request_call’,{now: $(’#now’).val(), calendar: $(’#calendar’).val(), phonerc: $(’#phonerc’).val(), numerc: $(’#numerc’).val() },function(data){

	alert('Your request has been sent!');
});

}[/code]

Sponsor our Newsletter | Privacy Policy | Terms of Service