如何在每个部分html / php的按钮单击上使用表单操作 [英] how to use form action on button click for each section html/php

查看:77
本文介绍了如何在每个部分html / php的按钮单击上使用表单操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我是php的新手。



i只设计了一个php整个网站的页面使用部分。



在每个部分我都有按钮,



现在怎么样?我使用表单动作为每个按钮调用

特定的php页面,点击按钮。



Php插入代码:

Hi guys,

i'm new to php.

i have designed only one php page for whole website using sections.

And in each section i have button,

now how can i use form action for each button to call
specific php page, on button click.

Php Insertion Code:

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







insertinterview.php代码:






insertinterview.php code:

<?php

include Conn.php;
if(!$conn)
{
	die('Could not connect to the server!');
}
else{
	$sql = 'INSERT INTO Interview'.
			'( 
			Employer_EmailID, 
			Job_Position, 
			Message, 
			InterviewDate, 
			InterviewTime, 
			Location, 
			InsertionDate)'.
			' VALUES ('.
				$_POST['iemail'].','.
				$_POST['iposition'].','.
				$_POST['imessage'].','.
				$_POST['idate'].','.
				$_POST['itime'].','.
				$_POST['ilocaiton'].','.
				$_POST['iemail'].','.
			')';	
			
	$retval = mysql_query($sql, $conn);
	$msg;
	if(!$retval)
	{
		die('Count enter data. ' . mysql_error);	
		$msg = mysql_error;		
	}
	else{
		$msg = 'Data Entered Successfully!';
	}
	
	echo $msg;
	
	mysql_close($conn);
}

?>





我创建了InsertInterview.php以插入到mysql中在表单操作中调用此页面,但我还有一个按钮用于联系我,然后是联系我页面,如何在表单操作中调用其特定页面。







I have created InsertInterview.php to insert into mysql and calling this page in form action, but i have one more button for contact me, then for contact me page, how to call its particular page in form action.


Currently i'm not able to insert records into the mysql database.







任何人都可以帮助我。





谢谢




can any one please help me.


Thanks

推荐答案

conn)
{
die( '无法连接到服务器!');
}
else {
conn) { die('Could not connect to the server!'); } else{


sql ='INSERT INTO Interview'。
'(
Employer_EmailID,
Job_Position,
消息,
InterviewDate,
InterviewTime,
位置,
InsertionDate)'。
'VALUES('。
sql = 'INSERT INTO Interview'. '( Employer_EmailID, Job_Position, Message, InterviewDate, InterviewTime, Location, InsertionDate)'. ' VALUES ('.


_POST ['iemail']。','。
_POST['iemail'].','.


这篇关于如何在每个部分html / php的按钮单击上使用表单操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆